Lesson 23/23 Pseudo Selectors


#1

I have an issue where on lesson 23, the computer keeps telling me that my 3rd paragraph has a font of 16px when in fact I made it to be 26 px. Here is my code

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

#2

you have a colon between child and (4), there shouldn't be a colon (:) there


#3

@stetim94 *shouldn't be a


#4

sorry, what? i feel like something is missing from your answer


#5

@stetim94

... there shouldn't be a colon (:) there.


#6

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

serious {

font-family:Courier;
color:#8C8C8C;

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

I also have a problem with css. "Oops, try again. Did you give your third paragraph a font-size of 26px? It looks like it's currently undefined."


#7

your css is fine, can i see your html code? No image please, i want to be able to run it

if you edit/update your question, leave a reply so i get a notification. take the following steps to make your code visible:

if this instructions are unclear, you can also insert 3 backticks before and after your code, like so:

```
<p>visible</p>
```

the backtick is located above the tab key on your keyboard


#8

this is mine html code.. where's the problem?










ppp


idid


iii


</body>


#9

you didn't take any of the steps i provided to make your code visible, please try again


#10

<!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">
		<p class="fancy"> ppp</p>
		<p id="serious"> idid </p>
		<p> iii </p>
		</h3>
		
	</body>
</html>

#11

you can't nest paragraph inside headings, and vice versa. headings are not designed to contain paragraphs. you should close your heading (h3) before starting with the paragraph, the reason this causes a error is because now you have 3 paragraphs, which are first, second and third child of h3, no 4th element.


#12

also don't work

<!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">
		<p class="fancy"> ppp</p>
		<p id="serious"> idid </p>
		
		</h3>
		<div>
		<p> iii </p>
		</div>
	</body>
</html>

#13

no, i said you should close your h3 before you start the paragraphs:

<h3>i am a heading</h3>
<!-- the 3 paragraphs -->

i didn't say anything about adding a div element. do you understand how nth-child works or do you want me to explain it?


#14

please explain to me.I will be thankful!


#15

did you manage to pass the exercise?

right, the exercise has asked you (if you exactly follow the steps) to create the following html code:

<body>
  <h3 class="fancy">heading</h3>
  <p class="fancy"> ppp</p>
  <p id="serious"> idid </p>
  <p> iii </p>
</body>

now, you can use either p:nth-child(4) or body :nth-child(4) to pass the exercise. (when using body, note the space between body and the colon). nth-child will count and make the 4th element (<p> iii </p>) have a font-size of 26px. some people get confused and think the correct code is p:nth-child(3), this is however not true. it is 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 put this would be to say that p:first-child wouldn't apply its styling, because the first element is a h3, not a paragraph


#16

I pass the exercise, thank you very much!


#17

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

serious {

font-family:Courier;
color:#8C8C8C;

}
p:nth-child(3){
font-size:26px;
}
my font size is 16px?? what's wrong to this code?


#18

i am going to quote myself:

i am sorry, but i hope you can understand it is frustrating to explain the same thing twice, in the same topic. This obviously only works if your html code correct as well, but i can't say anything about it, since it is not included in your post


#19

i pass site problem only, thanks :smile:


#20

This is what my problem was. I was nesting the paragraphs inside of the headings. Thanks!