我有一个固定宽度的 DIV,我想将其保留在浏览器视口(viewport)的底部。
不幸的是,我什至不知道从哪里开始尝试实现它。
显然,首先要做的是将 position
设置为 fixed
。但除此之外……没有任何线索。
最佳答案
参见 css-tricks:
CSS:
#footer {
position:fixed;
left:0px;
bottom:0px;
height:30px;
width:100%;
background:#999;
}
/* IE 6 */
* html #footer {
position:absolute;
top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}
关于html - 如何将 DIV 锚定到页面底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2971401/