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

Bug in the nth-Pseudo-class Challenge- Hyphen included

On the first question, in the css style sheet I typed in:

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

I got the answer wrong. What's wrong with this code here?

Sorry that the brackets and the declarations aren't indented. I typed the CSS code in as I normally would in the text field in the forum. I think I forgot the code tag.

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi nikoxyz,

You have a couple of spaces that shouldn't be there, one is after the colon and the other is before the opening parenthesis, it should be.

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

Thanks. Strangely, my text editor Brackets process accepts my code with spaces included. I guess different text editors act differently.