Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

glenn romaniuk
glenn romaniuk
33,659 Points

fixed header and fixed footer

Often called sticky header and footer. I've added top padding to the body so the markup following the header displays beneath it. Otherwise it will be hidden behind the header. The same is happening with the footer. The markup before the footer is hidden behind it. I've played around with padding-bottom for the body but it does not push the footer down. How can I do this?

2 Answers

You should have padding equivalent to the height of the header and footer. Try this link.

I found some useful tips at the CSS tricks blog: http://css-tricks.com/snippets/css/sticky-footer/

The issue with using fixed positioning is that if your page needs to scroll, the header and footer might not move accordingly. Unless you always want your footer and header in the same spot, I'd be careful about that, unless you know how to address this issue Dustin?

Chris Coyier promotes Treehouse on his website CSS-Tricks; he's not a part of Treehouse.

My mistake, I edited my answer to reflect that :)