Nth child error


#1

what is wrong with this code? nth child is to be used an third paragraph is the 4th child of body.Also, can we use it as 3th child of paragraph? the html and css codes are as follows

  <!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
	<h3 class="fancy">hello<h3>
	<p class="fancy">hello fancy</p>
	<p id="serious">hello serious</p>
	<p>hello third paragraph</p>
		<!--Add your HTML below!-->
		
	</body>
</html>

and css code -

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

Nth child
#2

This is a hex color so you need a # before it like so: #8C8C8C


#3

Your h3 closing tag is missing a slash, messing up the count


#4

Thanks Stetim...I was having the same issue but its being sorted


#5

i've put a # before hex color and closed h3 tag properly now . still not working ..
i've given the third paragraph a font size of 26px as instructed, but the error it is showing is - "Did you give your third paragraph a font-size of 26px? It looks like it's currently 16px."


#6

and sometimes its also showing that the third paragraph is undefined


#7

Check your zoom and make sure it's 100%


#8

Could you show us an updated version of your code?


#9

zoom is 100% . this is the updated version of code -
html -

<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
	<h3 class="fancy">hello<h3>
	<p class="fancy">hello fancy</p>
	<p id="serious">hello serious</p>
	<p>hello third paragraph</p>
		<!--Add your HTML below!-->
		
	</body>
</html>

and css -

/*Add your CSS below!*/
.fancy {
    font-family:cursive;
    color:violet;
}
#serious {
    font-family:Courier;
    color:8C8C8C;
}
   body:nth-child(4) {
       font-size:26px;
   }

#10

Your h3 header tag is not closed as you are missing /

Should be </h3>


#11

@zainabrawat already pointed out your h3 closing tag is still missing a slash, i pointed that out as well a while ago:

Uhm... you have two options: body :nth-child(4) to select the 4th element inside body, or p:nth-child(4) to select any 4th paragraph of any parent. Pay close attention to the spaces around the colon, it is crucial you get it right.


#12

yes got it now. i messed up with the spaces around the colon. the h3 closing tag was also missing . thankyou both of you.