2010-07-20 50 views
1

的背景圖像使用joomla組件從數據庫中爲幻燈片顯示拉取圖像。調整div

它將圖像設置爲div的背景 - 我需要將該圖像的大小調整爲幻燈片的寬度(620px)。

<div style="background: url({image1url}) top center no-repeat; 
width:620px; 
height:350px"> 
<div style="width:620px; 
    height:256px;"> 
<a href="{url}"> 
    <img src="modules/mod_jxtc_ezrealtywall/images/10x10spacer.gif" width="620" height="246" alt="10x10spacer.gif" /></a> 
</div> 
<div style="position:relative; width:620px; 
    height:104px;"> 

    <div style="position:absolute; width:620px; height:95px; background:#000; opacity:0.7; filter:alpha(opacity=70); "></div> 

    <div style="position:absolute;"> 
     <div style="float:left; 
      width:250px; 
      border-right: 1px dotted #cccccc; 
      color:#ebebeb; 
      padding-right:30px; 
      padding-left:20px; 
      text-align:right; 
      font-size:28px; 
      letter-spacing:-1px; 
      line-height:28px !important; 
      margin-top:16px; 
      font-weight:500;"> 
      {unitnum} {streetnum} {address} {locality} {postcode} 
     </div> 
     <div style="float:right; 
      width:250px; 
      color:#ebebeb; 
      margin:23px 40px 5px 0px; 
      padding-left:15px; 
      text-align:left; 
      font-size:11px; 
      line-height:11px !important;"> 
      {description} 
     </div> 
    </div> 
</div> 

+0

那麼你的問題是什麼? – Martin 2010-07-21 09:00:46

+0

這應該設置您的圖像大小10x10spacer.gif Martin 2010-07-21 11:12:45

+0

寬度x高度不適用於CSS bg圖像,Martin。 – NPC 2010-07-29 14:59:41

回答

1

不能調整使用CSS(除非你使用CSS 3未完全實現)的背景圖像。

3

Jeepstone是正確的,它是由CSS 3支持的,並且除IE(joy)以外的大多數瀏覽器都支持,但我不確定IE9是什麼?見http://www.css3.info/preview/background-size/更多的信息,以下是一個例子 - 在這種情況下,由中心的背景圖像,我得到一個調整背景圖像和IE用戶中獲得了裁剪的圖像,這有時是不夠好...也許...

.backgroundImage { 
    -o-background-size: 100% 100%; 
    -webkit-background-size: 100% 100%; 
    -khtml-background-size : 100% 100%; 
    -moz-background-size: 100% 100%; 
    background-position: center center; 
}