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 is it necessary to add a class to the header? Can just style header tag

Why is it necessary to add a class to the header? you can omit the class and just target the header tag in css so wondering why you added a class to it? Thanks

3 Answers

walter palma
walter palma
3,189 Points

You can, but you can have more than one header and you probably dont want every header with the same style :)

Matt WebDev218
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Matt WebDev218
Front End Web Development Techdegree Graduate 18,099 Points

You want the header to be 100% width, but all the content of the header to be inline with main content of the page. That way the headers background styling extends the full width of the screen.

is it possible to have multiple headers? is that the reason why we use a div to contain the header elements?