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 trialjarrod Reeves
6,357 PointsCreate 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
Colin Bell
29,679 PointsHere is another good resource to look at regarding nth-child. nthmaster
James Barnett
39,199 PointsI always use that to work out an nth-child before using it in my CSS.
Hugo Paz
15,622 PointsWhat you are doing is not correct. That rule selects the 4, 5, 6...
What you need is li:nth-child(-n+4)
James Barnett
39,199 PointsJames Barnett
39,199 PointsI always look there when I can't remember how to do something like ranges using nth-child.