This forum is now read-only. Please use our new forums at discuss.codecademy.com.

HTML Basics Forum

View Course » View Exercise

83 points
51ade7489a79632215002e47_699665722
Submitted by
Musab mohamed
over 2 years ago

Why it's doesn't work , 9/16

Hi ,
I spend a lot of my time in this page i don't know what's is the problem , Pleas chack the code .

<!DOCTYPE html>

    <html>
        <head>
    <title><h1 style="color: green; font-size:16px">Ch</h1></title>
        </head>
        <body>
            <h1>Big Heading</h1>
                <p style="color: violet"></p>A giant bear and a little duck were friends.</p>
                <p style="color: red"></p>But the bear got hungry and ate the duck.</p>
        </body>
    </html>

#Regards


1 vote

permalink

Here is what I put and the correct code:

<!DOCTYPE html>
<html>
    <head>
        <title style="font-size: 16px"> Changing the colors!</title>
    </head>
    <body>
        <h1 style="font-size: 16px; color: green"> Big Heading</h1>
            <p style="color: violet"> A giant bear and a little duck were friends.</p>
            <p style="color: red; font-size: 10px">But the bear got hungry and ate the duck.</p>
    </body>
</html>

I also noticed that you didn't put delimiters (which are the ;/semi-colon sign from CSS styling), make sure to put them in after you put the color's name. After styling a paragraph, make sure to not put a closing tag after the opening tag instead put it at the end of the content so like this:

<p style = "cursor: crosshair; color: red;">This is an example. </p>

Good luck, and make sure to ask more questions if you need help!

1024 points
54a30cbfe39efe5da7017042_701892733
Submitted by
Mohamed Suufi
over 2 years ago

4 Comments

51ade7489a79632215002e47_699665722 Musab mohamed over 2 years ago

Thanks a lot :) i get it well

54a30cbfe39efe5da7017042_701892733 Mohamed Suufi over 2 years ago

You're welcome.

54a30cbfe39efe5da7017042_701892733 Mohamed Suufi over 2 years ago

Make sure to mark it as best answer.

5671826195e378c47d000782_659060817 stetim94 over 2 years ago

this is not a best answer, please don't. it is just an answer + there are already so many best answers


0 votes

permalink

right, style is just an attribute, you can apply to many html elements. this:
<title><h1 style="color: green; font-size:16px">Ch</h1></title> is not good.
<h1></h1> should be used inside the body tags, not head tags. the styling of <title> is pointless since it shows up in the tab, where it will not be affected by styling like you just did, so that should just be:
<title>Ch</title>

you didn't apply style to <h1> don't know if that is needed, since your question is in the wrong section.

you added an extra set of closing paragraphs:
<p style="color: violet"></p>A giant bear and a little duck were friends.</p>

so, this means the bit that is styled is:
<p style="color: violet"><!-- any text that would be here --></p>A giant bear and a little duck were friends. <!-- this will not be styled --></p>

so remove the additional closing paragraphs in both paragraphs, and you should be good to go.

2409 points
5671826195e378c47d000782_659060817
Submitted by
stetim94
over 2 years ago