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

CSS The Selectors Solution

gene c
gene c
13,630 Points

How specific must we get to change the color of all list items inside an unordered list?

To change the color of all list items inside an unordered list:

Can't I just write

ul { color: red; }

instead of

ul li { color: red; }

1 Answer

Steven Parker
Steven Parker
231,236 Points

Your suggestion will work, but it targets the list itself instead of the list items, and relies on property inheritance.

That might actually be a valid technique; but the course was probably just using this example for teaching you how to target the items directly, which might be more important if you were setting properties that are not inherited.