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 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 :)