开发者

How to move a div in the bottom of the windows screen

I need to put a div "propped" to the b开发者_StackOverflow社区ottom of the windows browsers. Like the one with chat on facebook. It must be positioned always at the bottom of the screen, also when I scroll the page.

Fixed? I know IE7 sucks on it...

How can I do it?


#yourdiv {
    position: fixed; /* This will be always visible and positioned where you want */
    bottom: 0; /* place it to the bottom */
    z-index: 9999; /* You may want to be sure no other elements will be displayed on top of it, raise this if it's still being displayed under other elements */
}

http://jsfiddle.net/zQNcu/9/

Position:fixed is the way to go. This is the only way to have a div being displayed at the same position regardless of page scrolling. Otherwise, if this doesn't work (older browsers perhaps), you need JS to keep it at a specific position regardless of page scroll.


use the position: fixed; css property

#somediv {
    position: fixed;
    bottom: 0px;
}
*html #somediv {
    position: absolute;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜