Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS The Selectors Solution

Brady Gorman
seal-mask
.a{fill-rule:evenodd;}techdegree
Brady Gorman
Front End Web Development Techdegree Student 3,365 Points

ul li isn't working?

When I select the list item within the unordered list in the assignment, the properties aren't changing according to how I have them set. The answer video says the selector order is correct, but I can only get fonts to change when I specify the anchor (a) instead of the list item (li).

Very confused given I literally copy-pasted the final code for the assignment to see and even that won't change my text color.

ul li {
  color: lightcoral; /*-----font not lightcoral-----*/
}

ul a {
  color: lightcoral; /*-----font lightcoral-----*/
}
<header>
        <!-- LOGO -->
        <img src="logo.png" alt="Bookworm" id="bookworm">
        <nav>
          <ul>
            <li><a href="#">About</a></li>
            <li><a href="#">Articles</a></li>
            <li><a href="#">News</a></li>
            <li><a href="#">Get in Touch</a></li>  
          </ul>
        </nav>

1 Answer

Steven Parker
Steven Parker
218,692 Points

The issue here is inheritance. Some properties are inherited from the parent element, and some are not. And which is which depends on what kind of element it is. In particular, "color" is not inherited by anchor elements, so setting the color on a list item won't change the color of anchors inside it.

In the video, the list items are colored, but they are not anchors — just plain text in the list item.