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.


Code Challenge Pseudo-Class Selectors 2/4

Hi, I made a guess at the right answer, and it actually passed although I wasn't really expecting it to. Just want to ask other people if its the best way to do it?


Create a new rule that targets the 3rd list item only. Set the background color to the HEX value FF6347.

:nth-child(0n+3){ background-color: #FF6347 }

2 Answers

sorry bad english, not my native language.


nth-child(an+b) -> B = initial count and A = the order, in this case, you are setting that the background-color will start on the thir element and them all above, the right for your question is nth-child(3) { background-color: #FF6347 }

Hi Andrew,

You would want to simplify it as Gabriel has shown. Since it's 0n you could simply drop that off because it's not going to do anything. You would only need the an part when you need to select multiple children.


b is the starting child and then a is what you keep adding or subtracting to get the rest of the children.

Thanks guys.