我想动态地将我的页脚放在底页。
页脚必须固定在底部
如果页面中有更多数据,页脚必须自动放低。
html {
position: relative;
min-height: 100%;
}
body {
padding-top: 60px;
margin-bottom: 75px;
}
footer {
position: absolute;
bottom: 0;
width: 90%;
height: 45px;
line-height: 45px;
}
<div id="container">
<div id="main">
</div>
<div id="footer">
<div class="container">
<span>Place sticky footer content here.</span>
</div>
</div>
</div>
答案 0 :(得分:0)
我可能会对你想要的东西感到有些困惑,你希望页面页脚自动与正文文本隔开,无论添加了多少?
尝试Position: relative
。
Absolute
定位会将您的页脚从文档流中移出,因此如果您有很多垂直内容,则会将页脚放在其上。
这对我有用(假设我知道你在追求什么):
footer {
position: relative;
bottom: 0;
width: 90%;
height: 45px;
line-height: 45px;
padding-top: 15px;
}
您可以添加:
margin: 0
如果你想要更少的间距。