2010-03-01 130 views
0

這裏是我的HTML:爲什麼BG圖像不顯示?

   <div id="leftMenuWrapper"> 
        <div id="ramps" class="leftMenuHeaderButton"></div> 
        <div id="carServiceRamps" class="leftMenuSubButton"></div> <div class="clear"></div> 
        <div id="67RaceRampsXT" class="leftMenuProductButton"></div> 
       </div> 

這裏是我的CSS:

#leftMenuWrapper{ 
background:url(../images/main_elements/leftMenu_BG.jpg) repeat-y; 
border:#777777 thin solid; 
width:160px; 
margin-left:-19px; 
position:absolute; 
padding-bottom:5px; 
} 

.leftMenuHeaderButton{ 
width:175px; 
height:35px; 
position:relative; 
top:-16px; 
left:-11px; 
} 
    #ramps{ 
    background:url(../images/main_elements/leftMenu/Ramps.png) no-repeat; 
    } 


.leftMenuSubButton{ 
width:169px; 
height:21px; 
position:relative; 
float:right; 
left:1px; 
} 
    #carServiceRamps{ 
    background:url(../images/main_elements/leftMenu/car-service-ramps.png) no-repeat; 
    } 

.leftMenuProductButton{ 
width:160px; 
height:20px; 
clear:both 
} 

    #67RaceRampsXT{ 
    background:url(../images/main_elements/leftMenu/67-Race-Ramp-XTs.jpg) no-repeat; 
    width:160px; 
    height:20px; 
    } 

.clear{clear:both} 

一切正常,除了<div id="67RaceRampsXT" class="leftMenuProductButton"></div>將不顯示它的背景圖片(它甚至不會顯示背景色)。元素在那裏,因爲如果我調整大小,它會相應地進行調整,但它不會在FF或Chrome中顯示圖像。

我可以把一個<IMG>這沒有問題,我甚至可以指定一個BG到.leftMenuProductButton但不#67RaceRampsXT

回答

6

我不認爲id S能以數字開頭。嘗試將您的id更改爲RaceRamps67XT之類的東西,並以此方式進行測試 - 在HTML和CSS中都可以看到它的功能。

+0

從來不知道!謝謝! – Jared 2010-03-01 19:48:13