html – 如何将DIV锚定到页面的底部?

前端之家收集整理的这篇文章主要介绍了html – 如何将DIV锚定到页面的底部?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个固定宽度的DIV,我想保留在浏览器的视口的底部

不幸的是,我不知道我甚至会开始试图实现这一点。

显然,首先要做的就是设定立场。但除此之外…没有线索。

解决方法

看到css-tricks:

Fixed Footer

CSS:

  1. #footer {
  2. position:fixed;
  3. left:0px;
  4. bottom:0px;
  5. height:30px;
  6. width:100%;
  7. background:#999;
  8. }
  9.  
  10. /* IE 6 */
  11. * html #footer {
  12. position:absolute;
  13. 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');
  14. }

猜你在找的HTML相关文章