Q23. Pseudo selectors


#1

I can't sure in the session, the answer would be

p:nth-child(4)

or

body:nth-child(4)?

But these two all didn't make my 3rd p in result.lab changed to font-size 26px. (although I passed the session)

Can anyone help?


Replace this line with your code.


#2

in case of body:nth-child(4) you need a space after body: body :nth-child(4) to select the 4th element inside body, this only works if the rest of your code is correct

Could you post your full html and css code?


#4

Hi

Thank you for reminding, I didn't notice there was a space before.
However, I added a space in my code, but it still didn't work for third

:frowning:

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


/*Add your CSS below!*/

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

#5

You got to add quotation marks for your class/id names in your HTML.
eg.

<h3 class="fancy">Header</h3>

ALSO, you didn't close your Second Paragraph properly.


#6

I really appreciate!!!!


#7