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

Kevin Kretschmer
Kevin Kretschmer
5,088 Points

Pseudo-Classes - :nth-child Code Challenge

I'm having a hard time in the coding challenge. The directions are:

Use the :nth-child pseudo-class to target the even list items only. Set the color to white and the background color to black.

I have come up with a solution, that corresponds exactly to the way it was shown in the video:

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

Please help. thank you.

3 Answers

Looks like you have a space in between "child" and "(even)" if so take that out


Tong Vang
Tong Vang
9,926 Points

Eliminate the space between child and left parathesis. Detail is critical in programming.

li:nth-child(even) {
   color: white;
   background-color: black;
Kevin Kretschmer
Kevin Kretschmer
5,088 Points

awesome... I knew it was something simple I was missing. Thank you so much, I'll try to pay it forward.