[英]How to place this div to the bottom of the page
我一直试图让页脚粘在页面底部。
这是基本布局:
<div id="div-header"></div>
<div id="div-body">
<h2>Some content</h2>
<div id="div-left">Left content</div>
<div id="div-right">
right content
</div>
</div>
<div id="div-footer-bottom"></div>
这就是我设计页脚的方式:
#div-footer, #div-footer-bottom{
background-color: red;
border-top: 1px solid #CCCCCC;
height: 40px;
padding: 20px 30px;
text-align: right;
}
#div-footer-bottom{
position: relative;
clear: both;
}
如下所示,当浏览器放大 100% 时,页面呈现正常:
但是如果浏览器放大到 120%,例如,页面是这样显示的:
请查看 jsfiddle 中的完整代码以发现我做错了什么,因为我不知道还能尝试什么:
提前致谢。
尝试添加以下css
#div-footer-bottom{
position: fixed;
bottom:0;
left:0;
clear: both;
width:100%;
}
对于重叠
将margin-bottom
添加到div-left
。 边距应等于页脚的高度(也添加填充像素)。 在你的情况下
#div-left
{
margin-bottom: 80px;
}
2014 年 3 月 24 日更新
对于您的第一个小提琴详细信息,只需添加以下内容并尝试,
body, html
{
height:100%;
}
在#div-body
css 中,删除min-height: 490px;
并添加min-height: calc(100% - 190px);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.