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 CSS Basics (2014) Basic Selectors Descendant Selectors

What part of the ordered list element is the number?

In the following code:

ol li { background-color: tomato; color: white; margin-bottom: 5px; }

The numbers next to each list item disappear. My question is: how can someone specifically target the number in each list item? For example, if I had the ordered list:

  1. Item number one
  2. Item number two
  3. Item number three

And used the above code, the "1.", "2.", and "3." apparently disappear.

My question is: why? And is there a specific way to target them (each individual number)?

1 Answer

Emma Willmann
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Emma Willmann
Treehouse Project Reviewer

As to why your numbers would disappear with the code listed, I'm not sure. I don't see anything that would do that. As for styling the numbers, I found this article that talks about styling them. You could probably also use an nth-child to be able to style numbers in the same list differently.

After I posted the question, I figured out that the background was white and it made the text white, including the numbers, so they blended in with the background

Thank you for the article link!