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.

Alan Shahry
Full Stack JavaScript Techdegree Student 23,184 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
8,846 Pointsthis should work i just tried it
li:first-child { color:white; background-color:black; }

Brandan Booth
8,846 Pointsthis should help you out
color:white; background:black;

Alan Shahry
Full Stack JavaScript Techdegree Student 23,184 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,184 PointsAlan Shahry
Full Stack JavaScript Techdegree Student 23,184 PointsYES!!! Thank you :-)