1

I have a div in a page (footer) and I want the following to happen with CSS:

If the page has not enough content to fill the window, the div should be at the very bottom. If the page has enough content (and a scroll bar perhaps appears) then I want the div to be after all the content.

If I do it with position absolute etc, I can't get the second case to work.

Any ideas?

William Niu
  • 15,798
  • 7
  • 53
  • 93
George Kastrinis
  • 4,924
  • 4
  • 29
  • 46

2 Answers2

2

I think you're looking for 100% min-height layout. Check out this post: 100% Min Height CSS layout.

Community
  • 1
  • 1
William Niu
  • 15,798
  • 7
  • 53
  • 93
1

You want to use a sticky footer.

For example: http://ryanfait.com/sticky-footer/

or if you google Sticky footer you find a few alternatives

Ben
  • 1,022
  • 3
  • 13
  • 23