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.

CSS

Problem with nth-child

Hi There

I am doing some CSS Foundation work and have become stuck on a code challenge

The question is

Create a new rule that selects the 3rd list item only. Set the background color to the HEX value FF6347.

To which I am using

/* Write your CSS below */
 li:nth-child(even){
color:white;
background:black;
}
li:nth-child(3){
color:#ff6347;
}

The first nth-child(even) is the answer from the previous and works fine. I just don't see where this is going wrong as it even makes the correct change in the preview.

Any help appreciated - the error I get is Bummer! Check the selector in your CSS.

Thanks

G

DOHHHHH!!!!! Background colour

2 Answers

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Yep. Glad you figured it out, Graham :)

No problem Guil and kudos to you and the team on a stella course - been writing CSS for about 4 years now and in the space of half a dozen videos have already learned (and dare I say used) some really nifty selectors.

Thanks

G