Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Wrapper div

Hello, if i want my footer and header and all my elements to span the whole page, do i need a wrapper div?

Tim Knight
Tim Knight
28,863 Points


I'm guessing you mean span the whole page width correct? If that's the case you don't necessarily need a wrapper div however it could help you in creating your margin against the sides of the browser. You could add your body directly on the body tag, but depending on how you're styling your background it might cause you a few issues. You could just as easily have a wrapper did that just set everything to 90% width to give you some spacing.

One thing to think about too when you're letting things flow 100% on the width is the readability of the line length. Check out this article for some interesting details that could provide some insight.

1 Answer

For this you don't exactly need a wrapper div.

html, body{
  height: 100%;

This will make your page span the height of the browser.