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!

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


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,888 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.