2013-12-21 40 views
0

這是我的代碼。 HTML:Img與CSS交換不起作用

<div id="socmed"> 

<div id="icons"> 
    <div id="fb"></div> 
</div> 
</div> 

CSS:

#socmed { 
height: 100px; 
padding-top: 70px; 
padding-bottom: 50px; 
background-color:rgba(247, 34, 34, 0.7); 
width: 100%; 
} 

#icons { 
width: 300px; 
height: 75px; 
margin: 0px auto; 
} 

#fb { 
height: .89in; 
width: .89in; 
background-image:url("../images/facebook_dark.png"); 
} 
#fb:hover { 
height: .89in; 
width: .89in; 
background-image:url("../images/facebook_active.png"); 

目前,既沒有標誌顯示在我的 「socmed」 分區。任何人都知道我在做什麼錯了?難住了。

+0

當你使用'檢查element'你會得到什麼? –

+0

圖像的路徑是相對於CSS:http://stackoverflow.com/questions/940451/using-relative-url-in-css-file-what-location-is-it-relative-to –

+0

所以目前我的目錄看起來像這樣。 style.css >>> CSS >>> index.html >>>圖片>>> facebook_active.png –

回答

0

檢查以下步驟:

1.圖像包含的文件夾路徑(inspect the path) 2.如果圖像尺寸是大就不會出現滿image.so它將根據所提到的dimension.for出現局部圖像這個問題用background-size財產

請看:DEMO