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

Imtiaz Govani
Imtiaz Govani
1,422 Points

Help

Can't see what i'm doing wrong here..

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

Regards, Imtiaz

Could you give us some context. That looks like valid CSS. But I am unsure what your task was so can't confirm if it is correct

Andrew Shook
Andrew Shook
31,709 Points

Adam Sackfield , this is the code challange Imtiaz Govani was referring to. Do you know if CSS allows a space between "nth-child" and the first parenthesis or not? I've never had a problem with that in the past. I could be just a glitch with how the code challenge is parsing the css?

1 Answer

Andrew Shook
Andrew Shook
31,709 Points

Ok so I'm not sure if this is just a glitch with the code challenge or a css rule, but the challenge will pass with your code if you remove the space between nth-child and the first parenthesis before "even".

Imtiaz Govani
Imtiaz Govani
1,422 Points

Thanks, that cured the problem!