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 trialFarzana Sarangi
3,219 PointsChange the color of all list items inside an unordered list
When you change the color of list items using the selector "ul li {}", why does it only change the color of the list items in the <div class="list-primary"> tag and not the list items in the <nav> tag as well?
1 Answer
Samuel Glister
12,471 PointsHi Farzana,
The difference between the two is the 'ul li {}' is only targeting list items within an unordered list. In the navigation you have anchor elements inside the list item which by default will not take on this style.
If you want to target both list items and the links within them you could do something like this:
ul li, ul li a {
color: red;
}
Farzana Sarangi
3,219 PointsFarzana Sarangi
3,219 PointsHi Samuel,
Thank you for your quick and helpful response!