Problem at 23.Pseudo selectors (Review)


#1

The excersice asks that "Add a third paragraph to the HTML document. On the CSS tab, use nth-child to give it a font size of 26px."

the html code is :







fwdjk


test


test test test



and CSS Code is

.fancy{font-family:Cursive;
color:violet}

serious{font-family:Courier;

color:#8c8c8c}

/*Thats the code i wrote*/

body :nth-child(4)
{
font-size:26px;
}

And that is the message " Oops, try again.
Did you give your third paragraph a font-size of 26px? It looks like it's currently undefined.
"
I can't understand whats going wrong , can anyone help me??


#2

Your css is fine, i guess the mistake is in your html code, please make it visible using the following steps, if you edit/update your question please post a reply so i get notified:


#3
<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
		<h3 class="fancy"><p class="fancy">fwdjk</p></h3>
		<p id="serious">sfvz</p>
		<p>sfvfgvsvsvsvsvfsvz</p>
	</body>
</html>

now is visible?


#4

that explains a lot, never nest paragraphs inside headers (h3), this should be:

<h3 class="fancy"><p class="fancy">fwdjk</p></h3>

should be:

<h3 class="fancy">header</h3>
<p class="fancy">fwdjk</p>

you understand nth-child? body :nth-child(4) had nothing to select, there where only 3 elements nested inside body


#5

oh ok , yes but i was a bit confused. now i understand why it couldn't work!
Thank you a lot!!


#7

For the next time, make sure your html code is visible, i provided instructions for that earlier in this topic


#8

5 posts were split to a new topic: Problem at 23.Pseudo selectors (Review)


#13

Hi, I'm having the same problem!
here's my HTML:

<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
		<h3 class="fancy">class selectors<h3>
		<p class="fancy">test</p>
		<p id="serious">test</p>
		<p>24</p>
	</body>
</html>

and my CSS:

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

The preview looks like it works but the message: "Did you give your third paragraph a font-size of 26px? It looks like it's currently undefined" keeps showing up. Can anyone tell me what I'm doing wrong? Thanks.


#14

your h3 closing tag is missing a forward slash (/)


#15

Ahhh! Thank you! Bashed my head against this for far too long!


#16

A post was split to a new topic: 23 pseudo selector need help


#17

2 posts were split to a new topic: Problem at 23.Pseudo selectors (Review)


#20

2 posts were split to a new topic: Problem at 23.Pseudo selectors (Review)