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

Create a new rule that targets the first 4 list items only. Set the font weight to bold.

li:nth-child(n+4){  
font-weight: bold; }

I am getting an error message.

Thanks

3 Answers

Here is another good resource to look at regarding nth-child. nthmaster

I always look there when I can't remember how to do something like ranges using nth-child.

I always use that to work out an nth-child before using it in my CSS.

What you are doing is not correct. That rule selects the 4, 5, 6...

What you need is li:nth-child(-n+4)