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.

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?