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

Design Web Typography Final Project: Create a Typographic Site Header and Summary

Why do you overwrite h1 as a descendant selector of header?

Why would you apply styling for the h1 two times? Isn't that DRY example? I mean could you just apply new font-size and other properties in h1 selector instead of duplicating it under header h1 selector?

2 Answers

Steve Gallant
Steve Gallant
14,943 Points

Hi Djordje, In this example, he is actually styling two different elements - the h1 elements specifically in the header section of the page, and then all the rest of the h1 elements on the page. They require different settings based on his design needs.

hope this helps! Steve

Zack Jackson
Zack Jackson
30,220 Points

Sometimes you might want certain attributes to apply specifically to a certain h1, but you may also want general styles to apply to all of the h1 elements. For instance, you may want different colored headers on the same web page, but the font-size to stay the same for all of them.