Error in Pseudo selectors


#1

Hi , this is a Instructions :
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 is my code :
HTML :

<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Result</title>
</head>
<body>
<h3 class="fancy">header</h3>
<p class="fancy">paragraph</p>
<p id="serious">paragraph2</p>
<p>paragrap3</p>
</body>
</html>

CSS:

.fancy{font-family:cursive;color:violet}
#serious{font-family:Courier; color:#8C8C8C}
p:nth-child(3){font-size:26px}

the error :
Oops, try again. Did you give your third paragraph a font-size of 26px? It looks like it's currently 16px.


i try it in firefox & chrom but i have same result :cry:


#2

It should be p:nth-child(4), nth-child counts all elements, and if the 4th element is a paragraph, apply the styling between the curly brackets. A better way to explain would be to say p:first-child won't apply its styling since the first element is a h3, not a paragraph


#3

thank you . Its run now :grinning:


#4

why i am getting this error message?


#5

because the paragraph with id serious has a uppercase closing tag, which means it doesn't match with the opening tag, which means the count for nth-child messed up, which means you get an error message, next time, could you copy paste your code to the forum rather then images?


#6

now it is working..
okay next time i will copy paste my program rather than images.
thank you..!!