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
L McLean
Courses Plus Student 5,329 PointsCSS psuedo class (:nth-child selector)
Hello! How come I am getting this wrong? The question is: "Use the :nth-child selector to select the even list items only. Set the color to white and the background color to black.
I have this:
li :nth-child (even)
{
color: white;
background-color: black;
}
Thank you!
6 Answers
samiff
31,206 PointsMake sure you don't have a space between li and nth-child
li:nth-child(even) {
color: white;
background-color: black;
}
L McLean
Courses Plus Student 5,329 PointsThere is colon after background color. sorry.
L McLean
Courses Plus Student 5,329 PointsThank you Sam Lucklore! HA! I need a tutorial just on where to put spaces. LOL!
samiff
31,206 PointsI feel you on that! I find myself on SelectORacle sometimes still when my mind has blanked and something isn't working. Good luck with the rest.
James Barnett
39,199 Points+1 for the SelectORacle
And for complex n-child selectors there's the visual nth-child calculator
James Barnett
39,199 PointsL McLean -
I need a tutorial just on where to put spaces.
The only place you should use a space in a CSS selector is for a descendant selector.
Check out this quick tip on the importance of a space in CSS selectors