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 CSS Foundations Advanced Selectors Pseudo-Classes: :nth-child

Cannot pass the code challenge. Please help!

code challenge link is here

"Finally, create a new rule that targets the last 3 list items only. Set the font size to 30px."

li:nth-child(even) {

  color:white;

  background-color:black;

}

li:nth-child(3) {

  background-color: #FF6347;

}

li:nth-child(-n+4) {

  font-weight:bold;

}

li:nth-last-child (-n+3) {

  font-size: 30px;

}

3 Answers

Richard Duncan
Richard Duncan
5,568 Points

Hi Rui, you have a slight syntax issue caused by a space before the parenthesis (), remove the space. Hope this helps!

Example after the jump: http://jsbin.com/tomutiwoki/1/

Check this comment I added on this block of your code.

 /*Below, you have a space before the parenthesis of the selector
...replace it with  li:nth-last-child(-n+3)*/

li:nth-last-child (-n+3) { 

font-size: 30px;

}

Oh, now I understand. Thanks so much!

You are welcome Rui :)