2011-06-16 87 views
1

可能重複:
How to force a DIV block to extend to the bottom of a page, even if it has no content?頁腳不會延伸到頁面的底部在網站上

我一直在讀的最後幾天,但還沒有解決方案。

我正在寫一個普通的舊html網站,看起來頁腳不想延伸到頁面的底部。我一直在測試無盡,但仍然沒有結果。

這是代碼片段。

<div id="footer"> 
     <div id="footer_content"> 
      <p> &copy; 2011 KRG Maintenance - All Rights Reserved - Contact Us</p> 
     </div> <!--footer content ends--> 
    </div> <!--footer ends--> 
</body> 
</html> 

body{ 
    position:relative; 
    background:#383d43 url(../images/body_bg.jpg) repeat-x; 
    color:#000; 
    font:62.5% Myriad Pro,Arial,sans-serif; 
} 
#footer{ 

    width: 100%; 
    float: left; 
    clear: both; 
    height: 100%; 
    background-color: #ffffff; 
    background: #1e2329 url(../images/footer_bg.jpg) repeat-x; 

} 

#footer_content{ 

    margin: auto; 
    width: 943px; 
    padding: 17px 17px 0px 0px; 
} 

我是擴展到頁面底部的頁腳,但它只是掛在下面的空白處。 我真的很困惑,看起來其他解決方案沒有解決它。 任何幫助將不勝感激。

+0

http://www.google.com/#q=footer+bottom&fp=a03adfb3d03c3a22 – 2011-06-16 21:27:19

+0

感謝Robert Harvey。 我昨天試過,沒有成功。由於某種原因,它現在有效:S – harvey 2011-06-16 21:42:55

+1

「我昨天試過這個,但沒有成功。出於某種原因,它現在可以工作」 - 我們都知道這種感覺。 – 2011-06-16 21:56:26

回答

0

羅伯特哈維的第一個鏈接看起來不錯:確保身體本身足夠大,允許<div>做你想做的。

因此,height: 100%爲您的body應該幫助你。

0
#footer{ 
display: block; 
width: 100%; 
float: left; 
clear: both; 
height: 100%; 
background-color: #ffffff; 
background: #1e2329 url(../images/footer_bg.jpg) repeat-x; 
}