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

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

Bummer! Check the selector in your CSS. Make sure font-weight is set to 'bold'.

 :nth-last-child(-n+3) {
    font-size: 30px;
    }

6 Answers

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

I think I see the problem. You need to supply the HTML element that you want to select. The challenge is asking you to select the last 3 LIST items. For example

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

}

Your code doesn't specify the li element

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

}
Chase Lee
Chase Lee
29,275 Points

Randy Crowson. This should work:

ul li:nth-last-child(-n+3){
  font-size: 30px;
}

Randy's right it's ul li:nth-last-child(-n+3){ font-size: 30px; }

Luca Dan
Luca Dan
6,012 Points

li:nth-last-child (-n+3){ font-size:30px; } it is not working why?

li:nth-child(n+5){ font-size: 30px; }

or

li:nth-last-child(1n+5){ font-size: 30px; }

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Check the CSS property you're using in your code. It's not the one the question is asking for.

I don't understand.