PDA

View Full Version : Question about Footer in CSS layout



tjv189
15 Nov 2010, 10:15 AM
I was just wondering what the proper way to do what I'm about to describe is.

If you have a CSS layout with your container or content div immediately above your footer, what is the 'proper' way to get your footer to automatically be pushed down when the content area grows taller from putting more content in it? In other words, what is the common way to get the footer to move down the page and remain immediately after the container when the container has more and more content added to it?

What has seemed to work for me was setting the overflow of the container div to 'hidden', but is this the right way to do it? Or is there a different, more reliable way to accomplish this? Thanks in advance.

Wickham
15 Nov 2010, 10:45 AM
There are two main ways to code a "sticky footer".
1. This type stays at the bottom of the window if the page hasn't got enough content to fill the height, but if there is enough content above, the footer stays out of sight immediately below the content and you scroll to see it. See
http://www.cssstickyfooter.com/
http://ryanfait.com/sticky-footer/

2. The footer uses position: fixed; bottom: 0; and is visible all the time and content scrolls behind it.