这是简单的html:
<div id="wrap">
<div id="main">
</div>
</div>
<div id="footer">
</div>
这是CSS:
* {margin:0;padding:0;}
html, body {height: 100%;}
#wrap {min-height: 100%;}
#main {overflow:auto;
padding-bottom: 150px;}
#footer {position: relative;
margin-top: -150px;
height: 150px;
clear:both;}
我的问题是将填充底部添加到#wrap div而不是它的#main div不是更有意义吗?
如果您想知道,这与页脚始终位于底部并且在调整页面大小时不与之前的内容重叠有关。