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

0 points
Submitted by patricia_grace
over 8 years

Also a first child or...?

In the First Child exercise (16/23), part of the original code looks like so: <body> <div> <p>I'm the first child!</p> <p>We're not.</p>

Just for giggles, I took out the div element and replaced it with a header element.

<body>
    <h3>
        <p>I'm the first child!</p>
        <p>We're not.</p>

The formatting didn’t carry over in this case. Isn’t the first paragraph element here still the first child of an element(in this case, the h3 element)? The info given in the instructions tells us that, for example,

p:first-child { color: red; } Would make all paragraphs that are the first children of their parent elements red.

But, this isn’t the case if you change the element from a div to something else. Is that an error with CodeAcademy or is something being left out in the instructions?

Answer 559cd0b9e39efeddc30007d1

0 votes

Permalink

as demonstrated here in this example, the first paragraph is still becomes red. there are just a few problems:

Never nest a paragraph inside a header (h3) and vice versa. h3 and paragraph are only to designed to hold text.

SCT (submission correctness test), the program that checks your code, can a handle a little creativity, but there is a limit in the creativity if you want to pass the exercise.

points
Submitted by stetim94
over 8 years