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 CSS Layout Basics Getting Started with CSS Layout Centering Page Content and Creating a Full-width Header

Why was the wrapper for the header added inside of the <header> tag instead of outside it?

In the HTML for this video the instructor adds the <div class='container'> code inside the <header> tag while i suppose a container should be outside the header right?

2 Answers

Hi Sachin

Putting a container around the content allows you to keep the content in the center of the browser. So in the video, the header is styled to have a green background at 100% width but if the container was to be added around the header as well this would mean that the header would only span 70% of the width and the green background wouldn't go outside of this container.

Steven Parker
Steven Parker
231,269 Points

It depends on what is being contained.

In this case, it's the contents of the header, not the header itself. This allows different styling to be applied to the header as a whole, and separately to the contents.