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

Structural Pseudo-classes Code Challenge Question #3

Im going through just fine and here is my code for each of the first 3 questions. On the (-n+4) part, when I put that in, it tells me that "It looks like Task #1 is no longer passing" ?? But if I change it to something else like (n+4) it just tells me I need to check my selector!

omg what am I doing wrong? To me these selectors are getting crazy hard to remember all of them and no matter what Im going to have to review these before I ever put them in a site lol

li:nth-child(even) { color:white; background-color: #000; }

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

li:nth-child(-n+4) { color:white; background-color: #FF6347; font-weight:bold; }

4 Answers

James Barnett
James Barnett
39,199 Points

Shawn Katzenmeier - Remember to follow the instructions exactly the 3rd step made no mention changing the color or background just the font-weight.

Check out http://nthmaster.com/ to help you get a better grasp on nth-child.

If you are ever having trouble working out a complex nth-child you can always try it out on the nth-child visual calculator

James Barnett
James Barnett
39,199 Points

Guil Hernandez - There appears to be a bug for the correctness check on step 2 on this code challenge

the code challenge engine marks li:nth-child(3n) { background-color: #FF6347; } as correct, where it should only allow nth-child(3).

Thanks James! Sometimes its easy to get frustrated and miss little details.

the nth-child calculator is really cool!

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Thanks James Barnett,

I'll take a look at this right away! :)