CSS selectors no.23 STUCK!


#1

Cant get my head around this one, so I need some help!

Error comes up saying:

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

Here is my HTML:

<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
	<h3 class="fancy">This is the header     </h>
	<p class="fancy">This is a paragraph    </p>
	<p id="serious">This is another         paragraph</p>
	<p>This is the third paragraph but      the fourth child</p>
	</body>
</html>

And here's the CSS:

.fancy {
    font-family:cursive;
    color: Violet;
}

#serious {
    font-family: Courier;
    color: #8c8c8c;
}

.body :nth-child {
    font-size: 26px;
}

Help!

Chris


#2

nth-child requires brackets:

:nth-child(x)

and x being the number for the how maniest element you want to target. Also, body should have a full stop (.) in front of it, given body refers to a html element, not a class name


#3

Hello Chris,

Some remarks regarding your code:

In your case 'body' in not a class name - it's a html tag name (like

or ..).
So, you don't need
a dot in front of body selector in your css.
When using ":nth-child(x)" pseudo selector, you have to specify a
number, which in your case is 4. That's a 4-th child of the body element. Like this:

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

p.s: take a look at your <h3> closing tag:)

#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.