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

Create a new rule that selects the 3rd list item only. Set the background color to the HEX value FF6347.

Hey, I am having a difficult time with the following: Create a new rule that selects the 3rd list item only. Set the background color to the HEX value FF6347. Can anyone offer some advise?

My attempt to answer the question is as follows:

li:nth-child(even) { color: white; background-color: black; } li:nth-child (3) { color: white; background-color: #FF6347; }

2 Answers

James Heinlein -

li:nth-child (3) { color: white; background-color: #FF6347; }

You have a space between nth-child and your expression (3), remember in CSS spaces are syntaxically significant they refer to descendant selectors

Jacob Miranda
Jacob Miranda
19,392 Points

The argument you are trying to use is (an+b)

a = the first number it starts at, b = the pattern? I guess you could say.

I believe you can just use nth-child(3n). I can try doing the quiz again to make sure. Btw you can always also check the forums because this question and a similar few have been asked multiple times, so feel free to investigate other answers. And again, happy coding!

I believe you can just use nth-child(3n)

3n means every third whereas 3 means just the third item.

You can double check your nth-child calculations with the nth-child calculator if you need more info on nth-child check out nthmaster.com tutorial for more details.