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

CSS

Structural Pseudo-classes

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

Why is my answer not working?

Answer: li:nth-child(3) { color: white; background-color: #FF6347; }

Gabriel Colombo
Gabriel Colombo
7,788 Points

I don't remember the challenge itself, but I think you shouldn't change the color to white, only the background color. You answer works - http://jsbin.com/emokij/1/edit

7 Answers

The issue is the pound sign missing before background-color: #FF6347;

li:nth-child(even){ color: white; background-color: black; } li:nth-child(3){ color: white; background-color: #FF6347; }

...it works in theory and it actually selects the third child...but it won't let me continue....I guess it's a bug...I'm super jealous that you have 3,000 points, by the by.

Alex Heil
Alex Heil
53,547 Points

hey motty, as gabriel said the answer itself is correct and it should let you pass even when changing color to white was not needed ;) also I just re-did that challenge to test it out and the code let me pass without probs.

however, have you perhaps simply changed the line from task1 of the challenge to accomplish this? If so then it won't let you pass because it also checks for the existence of your answer in question 1. so make sure you add the 2nd answer without changing the first - hope that helps ;)

Gabriel Colombo
Gabriel Colombo
7,788 Points

Oh! Alex is right, I totally forgot to say that :P You shouldn't erase the previous tasks :)

I didn't initially erase the previous task...I initially tried to keep the "color: white;"...I only erased it after the initial answer didn't work.

Alex Heil
Alex Heil
53,547 Points

hey motty, please check if your code - at task 2 - is looking like this:

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

if so, all should go well and let you pass. the first line is the one from task 1 - this needs to be there still in task2 as it's checking for it, the 2nd line is the solution for the actual question then. hope that helps ;)

...still not working...

li:nth-child(3) { color: white; background-color: #ff6347; }

...yeah...I get the fact that all I should change is the (even) to (3) and the "background-color: black;" to background-color: #ff6347....I did this...

Gabriel Colombo
Gabriel Colombo
7,788 Points

you shouldn't just change, you have to add this new rule after the first one. Did you do that ?

I got it now...I'm sorry. I'm a moron. I assumed (for some reason or other) that I needed delete and rewrite. I didn't pay attention to the question. Thank you all for your help!

Alex Heil
Alex Heil
53,547 Points

you're welcome. great to hear that you got it working now ;)

Hey Guil,

It was giving me the "Oops! It looks like Task 1 is no longer passing." with the two options of either "Recheck My Work" or "Go to Task One"...and it's still giving me that output...I don't know what's wrong...even when I erase the "color: white;" from the previous question.

Gabriel Colombo
Gabriel Colombo
7,788 Points

Don't erase the previous tasks, if you do, the code won't be accepted

Guil Hernandez
Guil Hernandez
Treehouse Teacher

Motty Jaffe –– Ok, so that means that the previous step was either changed or removed. If you retake the code challenge without changing anything from step 1 on step 2, it should pass just fine. :)

Hope this helps.

Gabriel Colombo
Gabriel Colombo
7,788 Points

For example: Task 1 { ... }

Then when you click in next, you keep the task 1 in the document Task 1 { ... } Task 2 { ... }