The font-size only changes when I enter an incorrect code


I'm on the last lesson of CSS Selector (Pseudo selectors) and the task is to create a paragraph and change it's font size to 26px using the nth-child selector.

It tells me in the hint to use nth-child(4) to select the paragraph, but when I use it the text remains its original size.

However, if I change the four to a 3 (which it says is incorrect because the h3 counts as a paragraph), the text size changes to 26px like I want it to.

Either way, I still get the same error message every time I try to submit the code.

I tried resetting my laptop's zoom, I updated my laptop's software, and went through all of the troubleshooting steps in the Codecademy help section. I've read through the code numerous times and I think it's accurate. I really hope it's just a semi-colon I forgot to put in or something.

Thanks in advance :slightly_smiling:


If you nest the paragraphs inside the heading, then it make sense p:nth-child(3) changes the font-size, can i see your html code?


Here you go, sorry for the wait.


headings (h3 in this case) and paragraphs are both block level elements, they can hold inline element, but not other block elements. the paragraph should be after the heading, now you should be able to use nth-child(4) to complete the exercise. With the paragraph inside the heading, the heading is first child, the serious paragraph is nth-child(2), and the last paragraph is third child. the paragraph inside the heading (which is still wrong) would be first child of its parent (the h3 heading)


FINALLY GOT IT! Thank you for your help. I am now one step closer to being fluent in HTML and CSS :slightly_smiling: