Pseudo Selector - NTH CHILD


Hey!! I know a lot of people had the same problem as me but i can't seem to figure it out! Sorry to post this again! So these are the directions

 Add a third paragraph to the HTML document. On the CSS tab, use nth-child to give it a font size of 26px. Remember: your paragraph is the third paragraph, but the fourth CHILD of body. The h3 counts as the first child!

And this my code

/*Add your CSS below!*/
.fancy {
color: violet;

serious {

font-family: Courier;
color: #8C8C8C;


body :nth-child(4) {

thanks in advance
ps: i have tried both p:nth-child(4) and body :nth-child(4)


Might wanna make sure that the code is intact in your post.

You should be selecting a paragraph tag, not a body tag.


Nope i found the error in the html and it worked ... thanks!!


@ionatan, You can use both p:nth-child(4) and body :nth-child(4). body will select the 4th element nested somewhere inside body, p:nth-child(4) will select the 4th element inside body, and only apply the styling between the curly brackets if the 4th element is a paragraph (body will apply the styling, no matter what the 4th element is)


Oh. There was a space there, and you can leave out what element to match for and it'll match any kind of tag.

Wouldn't it be good to put a * there to show that it isn't a typo?


yes, that is right.

No? Both are valid. I don't see them as typos.


body:nth-child(4) {}
body :nth-child(4) {}

That's dangerously similar, body is probably a bad example.

While this is clear on its intent:

body *:nth-child(4) {}

still no?


Agree, but the exercise asks you to use body :nth-child(4). (see instructions in the exercise), so i understand why students just put body :nth-child(4) on the forum. I would personally just give a heads up that you have to look really closely at the spacing around the colon