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

41,216

You need to use position: fixed

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

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

Share:
41,216

Related videos on Youtube

manishkr1608
Author by

manishkr1608

Updated on July 25, 2022

Comments

  • manishkr1608
    manishkr1608 almost 2 years

    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.

  • neshpro9
    neshpro9 almost 10 years
    position:absolute; and then float:left;? Seriously??
  • Nasz Njoka Sr.
    Nasz Njoka Sr. about 3 years
    use z-index to make the element appear on top of every other elements on the page
  • Alex von Brandenfels
    Alex von Brandenfels over 2 years
    position: sticky is another good, more recent option for this, if you need the floating element to have a width based on some % of its parent. (A sticky element does need at least one sibling element after it, but you can just make a filler div)