我有两个容器div
,它们需要将它们的底边从视口的底部锁定为x像素。我需要和使用position absolute|fixed
一样的结果--但是我需要保持它们为position: relative
,这样它们才能正确地浮动,并与DOM的其余部分一起定位。
我只能找到基于javascript的解决方案,我真的更喜欢纯css的东西。希望有人知道我不知道的解决方案。
如果可能,需要支持IE7+。
发布于 2014-01-10 00:48:46
如果必须的话,IE7.js支持fix定位。
发布于 2014-01-10 01:03:24
下面是一个示例,说明如何使用您设置的指导方针来完成您想要做的事情。
http://jsfiddle.net/cornelas/38WqN/
<div id="footer">
<div class="footer-right">
</div>
<div class="footer-left">
</div>
</div>
CSS
#footer {
background: #666;
position: fixed;
bottom: 0;
width: 100%;
height: 20%;
}
.footer-right {
background: #ccc;
position: relative;
height: 100%;
width: 40%;
display: inline-block;
}
.footer-left {
background: #ccc;
position: relative;
height: 100%;
width: 40%;
display: inline-block;
}
https://stackoverflow.com/questions/21034196
复制相似问题