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 Techniques Grid Layout Testing our Grid

SERGIO RODRIGUEZ
SERGIO RODRIGUEZ
17,532 Points

grid-container class in header element

In Stage 5 of the CSS Layout course Guil inserts a new "div" inside the "header" element to set it as a grid-container class. Why can't we just use the "header" for that purpose?

Joshua Holland
Joshua Holland
2,865 Points

"Why can't we just use the ____ for that purpose?" If you posted code in there, it removed it.

2 Answers

We want to span the header the full browser width. At the end of the chapter we define a maximum width for our grid-container, thus makes it span just that amount of pixels. Inserting the new div ensures that only the content within will be set to the max-width, while the header spans the full width of the browser window.

Bianca Negron
Bianca Negron
9,486 Points

Could be because the header element should fill 100% of the screens width, whereas the grid-container will always have a smaller set width for different screen sizes.