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 trialAdam Brown
1,893 PointsText and Background Color
In 5:14 of the video, when the white background and grey text is applied to the body, why doesn't it override the header colors that were established earlier in the code since the header is also included in the body? Also, why not the section as well?
3 Answers
Justin Iezzi
18,199 PointsThis is called specificity. CSS sees that he's already written more specific rules for the nav element. Read more about this here: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
Adam Brown
1,893 PointsOkay thanks. So because he specified what would happen with any anchors, then that would override a general rule being applied later in the code? The section text below the images was still green, but I did notice the bullet points changed to grey. The section anchor elements wouldn't have changed because of specificity of anchor elements earlier in the code?
Justin Iezzi
18,199 PointsExactly right. The anchor rule was more specific than the body color property specified.
Adam Brown
1,893 PointsGreat, thank you very much.