我需要将页脚压低到页面底部,而不管页面上方有多少内容。所以,我没有在互联网上一些搜索,并根据该网站上发现一个解决办法:如何在上面div中浮动时压低页脚?
http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page
然而,一切工作确定,直到我申请“浮动:左”的内容股利。页脚不再处于底部,并且在中途受到撞击。我的问题是,如果在上面div中浮动时如何保持页脚下降?
请在这里看到这个的jsfiddle我的例子:
或代码在这里:
<style type="text/css">
html,
body {
margin:0;
padding:0;
height:100%;
}
#container {
min-height:100%;
position:relative;
}
#header {
background:#ff0;
padding:10px;
}
#body {
padding:10px;
padding-bottom:60px; /* Height of the footer */
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:60px; /* Height of the footer */
background:#6cf;
}
</style>
<div id="container">
<div id="header"></div>
<div id="body">
<div id="test" style="float:left">
blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>blah<br/>
</div>
</div>
<div id="footer"></div>
</div>
由于工作就像一个魅力。 – photonacl