2011-06-16 92 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; 
}