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
glenn romaniuk
33,659 Pointsfixed 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
Dustin Matlock
33,856 PointsYou should have padding equivalent to the height of the header and footer. Try this link.
Laura Cressman
12,548 PointsI 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?
Dustin Matlock
33,856 PointsChris Coyier promotes Treehouse on his website CSS-Tricks; he's not a part of Treehouse.
Laura Cressman
12,548 PointsMy mistake, I edited my answer to reflect that :)