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 trialTeacher Russell
16,873 PointsBody background and text color?
This is where css throws me a little. After setting color for the header, nav, we've then set the body background and text colors. If this is cascading, and the header and nav are part of the body, why aren't the colors set in the header and nav then changed back to the larger more general setting of the body?
1 Answer
edwardr
10,272 PointsHi Russell,
Keep in mind the rules are applied by the βcascadeβ are: 1. Importance, 2. Specificity, 3. Source Order.
+ IMPORTANCE relies on source origin: User Agent Styles, User Styles, Author Styles
- Author styles trumps User Agent and User styles.
+ SPECIFICITY: Highest specificity wins
+ SOURCE ORDER is based on the order the styles appear.
- Properties occuring later have more priority
The header and nav settings will take priority over the more general body settings because they are more specific. Just like a style format on the html page set in-line within the tags will take priority of a style in the CSS because it is more specific.
Check out the course CSS BASICS: #7 FUNDAMENTAL CONCEPTS for a good explanation.
Teacher Russell
16,873 PointsTeacher Russell
16,873 PointsGot it! Thanks!