开发者

How to anchor a DIV to the bottom of a page?

开发者 https://www.devze.com 2023-01-02 11:16 出处:网络
I开发者_如何转开发 have a fixed-width DIV that I want to remain at the bottom of the browser\'s viewport.

I开发者_如何转开发 have a fixed-width DIV that I want to remain at the bottom of the browser's viewport.

Unfortunately, I haven't a clue where I would even begin to try to implement this.

Obviously the first thing to do is set position to fixed. But beyond that... no clue.


See at css-tricks:

Fixed Footer

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');
}


#mydiv{
   position: fixed;
   bottom: 0px;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号