"'s in HTML


#1

when writing my code the preview comes up fine if I dont use quotation marks but all the instructions at the side use them.
Are they just something you should always use or is it a flexible thing?


#2

@digitaljumper61383,
If you could provide us with the code, you are writing about.....
or a link to the course-section....
that would be of help in a eventual explanation.


#3

Of course, sorry I'm quite new to this.
The course section is HTML Basics II 12. Background color
When my code is like this I cannot progress to the next section even though the preview appears correctly.

    <!DOCTYPE html>
<html>
    <head>
        <title>Sexy background color!</title>
    </head>
    <body style=background-color:brown>
        <h3>Favorite Football Teams</h3>
            <ol style=background-color:yellow>
                <li>The Hawthorn Football Club</li>    
                <li>San Franscisco 49ers</li>
                <li>Barcelona FC</li>
            </ol>            
    </body>
</html>

However adding " to the beginning and end of background-colour:brown and background-color:yellowas shown in the examples and as shown here

    <!DOCTYPE html>
<html>
    <head>
        <title>Sexy background color!</title>
    </head>
    <body style="background-color:brown">
        <h3>Favorite Football Teams</h3>
            <ol style="background-color:yellow">
                <li>The Hawthorn Football Club</li>    
                <li>San Franscisco 49ers</li>
                <li>Barcelona FC</li>
            </ol>            
    </body>
</html>

It allows me to progress even though the preview is exactly the same.
I would just like to know if I should always be using " with attributes or is there something else I'm missing?


#4

the quotation marks where mandatory before the arrival of html5. So now it works without quotation marks, but when this course was written it didn't. I still think without quotation marks it looks weird


#5

Ahhh I see, that makes sense thank you.
I've only just started learning HTML yesterday and I have had no experience with code at all before.
Does that explanation also account for

    <p style="background-color: red;">
    Hello
    </p>

and

    <p style="background-color:red">
     Hello
    </p>

(with the first being the way the instructions shows an example) doing the same thing?
Should I learn it the way it was done before HTML5 or does that not matter anymore?


#6

@digitaljumper61383,

The style Attribute
has a key:value pair....
if you use more pairs at once,
you will have to use the semi-colon-; as separator
like

 <p style="background-color:red; font-size: 16px">