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 trialStephen Sim
2,956 Pointsnth-child challenge. its not working?
I'm working on a structural pseudo-class code challenge. The problem is as follows:
"Use the :nth-child selector to select the even list items only. Set the color to white and the background color to black."
the code i wrote was:
li:nth-child (even) {
color: #FFF;
background-color: #000;
}
Am I missing something?
2 Answers
Lee Hughes
8,380 PointsLose the space between child and (even)
;)
Giles Rafol
1,060 PointsI didn't try it on this one, but one time I had to actually use the color keywords to pass. So try white and black instead of the hex values.
James Barnett
39,199 PointsColor keywords translate to specific hex colors, if they ask for lighblue
you'd need to look up what the exact hex code is equal to lightblue
as not just any color that light-ish blue will do.
Here's the offical color keyword list and their associated hex code.
Stephen Sim
2,956 PointsStephen Sim
2,956 Pointsamazing how a simple space can mess everything up.. gah! thanks!
Lee Hughes
8,380 PointsLee Hughes
8,380 PointsNo problem :)
James Barnett
39,199 PointsJames Barnett
39,199 PointsStephen Sim - Moral of the story: A spaces inside of a CSS selector is interpreted as the combinator for a descendant selector.