开发者

How to keep a div stuck in the same spot while the rest of page is scrolled?

开发者 https://www.devze.com 2023-03-05 11:35 出处:网络
example: http://www.ehow.com/how_2196172_ping-mac-co开发者_运维问答mputer.html As you can see the \"helpful?\" element is stuck in place even when you scroll the rest of the page. I\'m not sure if th

example: http://www.ehow.com/how_2196172_ping-mac-co开发者_运维问答mputer.html

As you can see the "helpful?" element is stuck in place even when you scroll the rest of the page. I'm not sure if this can be done with just css or needs js (preferably jQuery). How can this be done?


You have to fix the element position. Try something like this:

div#ID {
    position: fixed;
    bottom:10px;
    left:10px;
}

Hope it helps!


That is using position: fixed which positions an element with respect to the browser view port.

0

精彩评论

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