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

HTML How to Make a Website Customizing Colors and Fonts Use Classes in CSS

Emmanuel Rojas
Emmanuel Rojas
6,994 Points

Color of the body

If color green was already assigned to the anchor: a { color: #6ab47b; } At the end of this video, the body was assigned color grey:

body { background-color: #fff; color: #999; } But the anchor is inside the body and it was not affected by the new color. Why it is not affected? I thougth the last line you code is the las orther workspaces is going to follow, and the body is the whole document

1 Answer

Jeff Lemay
Jeff Lemay
14,268 Points

Specificity overrides being further down the css file. So since you're targeting anchor tags directly with a color, the color set for the body tag will be ignored.

It kind of goes in this order (least specific to most):

  • parent element (div)
  • element (ul)
  • class (.my-list)
  • class with element (ul.my-list)
  • ID (#your-list)