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 trialAlan Shahry
Full Stack JavaScript Techdegree Student 23,574 PointsBasic Structural Pseudo-Classes
In this drill I have a <ul> with <li>first child of ul</li> and I am asked to set the background color for the <li> to black and the color to white. My code in css is: li: first child of ul { background-color: black; color: white; }
but it keep saying that I still need to set the background color to black. What do you think is the problem?
3 Answers
Brandan Booth
9,321 Pointsthis should work i just tried it
li:first-child { color:white; background-color:black; }
Brandan Booth
9,321 Pointsthis should help you out
color:white; background:black;
Alan Shahry
Full Stack JavaScript Techdegree Student 23,574 PointsThanks for the quick reply. It did not work :-( I think there must be something wrong with the drill itself.
James Barnett
39,199 PointsMaybe I'm misunderstanding what you posted but li: first child of ul
is not a valid selector. li:first-child
however is valid.
Check out the section on structural pseudo-class in tutorial to learn more about the syntax of first-child
.
Alan Shahry
Full Stack JavaScript Techdegree Student 23,574 PointsAlan Shahry
Full Stack JavaScript Techdegree Student 23,574 PointsYES!!! Thank you :-)