This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by Jonathan Colburn
over 8 years

23/23, Same problem as others -- my fourth paragraph won't recognize 26px

HTML and CSS pasted below, any thoughts? I did reset my zoom, I don’t think that’s the issue, and also tried body: nthchild(4) with the space rather than p:nthchild(4) as it reads below

<!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 I guess</p>
        <p>third paragraph</p>
        
    </body>
</html>


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

    #serious {
        font-family: Courier;
        color: #8C8C8C;
    }
    
    p:nthchild(4) { 
        font-size: 26px;
    }

Answer 55f1409d95e37831a90002ce

0 votes

Permalink

nicely formatted code, well done. I guess you read some of the other answers?

Your problem is purely in css (your html is fine). the psuedo class selector is nth-child, you use nthchild (without dash/hyphen) which causes the error.

points
Submitted by stetim94
over 8 years

3 comments

Jonathan Colburn over 8 years

Thanks for the help! Yes, I read enough of the answers to get the formatting right but obviously not enough to spot my missing hyphen! Thanks again

stetim94 over 8 years

you’re welcome

AMAN GAUR over 8 years

Hello! I hava a doubt here . In the above code,i noticed that p:nth-child(4) was used.However, there are only 3 paragraphs present in the HTML code.Should not it be body:nth-child(4).Am I missing out something. Thanks, Aman

Answer 55faa96895e37837e200008e

0 votes

Permalink

Heey Amar,

if you want to use body, use body :nth-child(4) (with space between body and the colon) this tells css it looks for 4th child in body.

Yea, but nth-child counts all elements and if the 4th element is a paragraph, apply the css. Here is a example which might help:

<h1>i am header</h1><!-- h1:nth-child(1) or h1:first-child -->
<p>i am a paragraph</p><!-- p:nth-child(2) -->
<h2>i am a header</h2><!-- h2:nth-child(3) -->
<p>i am a paragraph</p><!-- p:nth-child(4) or p:last-child -->

As you can see more clearly from this example, all elements are included in the count, if you would apply p:first-child on this html code, nothing would happen. the first element is a h1, not a paragraph. So the css code doesn’t get applied/“executed”

Same with the html code from the exercise, you understand now?

points
Submitted by stetim94
over 8 years