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 trialAndrew Shipley
7,781 PointsCode 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?
Thanks
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
Gabriel Roczanski
Courses Plus Student 2,136 Pointssorry bad english, not my native language.
Look,
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 }
Andrew Shipley
7,781 PointsThanks guys.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi 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 thean
part when you need to select multiple children.Gabriel,
b
is the starting child and thena
is what you keep adding or subtracting to get the rest of the children.