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

not working code

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

That code does not work , why?

3 Answers

Do you mind posting your code so we may see what's wrong? Based on the CSS alone it should work. Here's a quick example I drafted: http://jsfiddle.net/wv9fhk8n/

Try removing the semicolon after the closing bracket. It should look like this:

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

it needs a space between ) and {

Actually, that's in no way required. Personally, I like it without a space