Keep div in position after user scrolls page

user852974 picture user852974 · Aug 2, 2011 · Viewed 15k times · Source
#div1 {
    background: #ffffff;
    padding: 6px;
    color:#333; 
    font:normal 10px Arial, Helvetica, sans-serif; 
    text-decoration: none; 
    text-transform: uppercase;
    position: absolute;
    bottom: 20px;
    right: 20px;
}

This div maintains a position 20x20 px from the bottom right corner of the page. But my site contains an "endless page" pagination feature and when scroll bars appear on the browser window because the content increases, the div does not maintain its position in the bottom right hand corner but rather moves up the page. How can I get this div to stay in the bottom right corner even when the user scrolls or when scroll bars appear? Thanks

Answer

Warface picture Warface · Aug 2, 2011
position: fixed;

This should do it