Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make a floating div that will float at the bottom of page

I want to make a floating div that will sit at the bottom of the page if bottom of current page is above window screen otherwise it will sit just above windows screen taskbar and if we scroll the page it will maintain its current position.

like image 930
manishkr1608 Avatar asked Aug 05 '13 04:08

manishkr1608


People also ask

How do you make a div float to the bottom of the page?

Set the position of div at the bottom of its container can be done using bottom, and position property. Set position value to absolute and bottom value to zero to placed a div at the bottom of container.

How do I bring an element to the bottom of the page?

If position: absolute; or position: fixed; - the bottom property sets the bottom edge of an element to a unit above/below the bottom edge of its nearest positioned ancestor. If position: relative; - the bottom property makes the element's bottom edge to move above/below its normal position.

How do you stop DIVS from sliding when floating?

Set height and width to 100% for the bottom div and set overflow auto on the bottom div as well. Now the div will not move up to fill space.


1 Answers

You need to use position: fixed

#footer {
    position: fixed;
    bottom: 0;
    width: 100%;
}

Here's the fiddle: http://jsfiddle.net/uw8f9/

like image 171
icodebuster Avatar answered Sep 21 '22 20:09

icodebuster