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 Foundations Advanced Selectors Pseudo-Classes: :nth-child

How can I select the 3rd li element for the Advanced Selectors code challenge?

I am stuck on Stage 3 Advanced Selectors code challenge. I am trying to select the 3rd li element by using the nth child function. I am not sure what I am doing wrong. Here is my code

li:nth-child(3){ color: #FF6347; }

Here is a screenshot Imgur

Not sure what I'm doing wrong, looking forward to your response! :) Thank you, Isaac

3 Answers

Ricky Walker
Ricky Walker
12,863 Points

That code is correct. The only problem is you're writing "color" instead of "background-color". Also, is it following the first rule of that challenge? Meaning is it written after the first rule of that task like so?

li:nth-child(even) {
  color: white;
  background-color: black;
}

li:nth-child(3) {
  background-color: #FF6347;
}

Hi

It says to select background colour ! not colour . so instead of colour type background-color , that should solve the problem ^^

Hahaahahaha of course its something so simple! Man I sat there forever reading about nth child functions and couldnt figure it out. Thank you both!

Ricky Walker
Ricky Walker
12,863 Points

Yeah that's the life lol! Sometimes we get so caught up on the problem being complex, we forget to check the basics