The font element is obsolete. Use CSS...

User 404575 Photo


Registered User
887 posts

If someone used the font element <p><FONT SIZE=+1 > instead of css, because they ran out of font sizes and colors in the limited <h> tags, is there another way to do this in W3 compliance with HTML 5?

I just don't know how.
Melissa Rhiannon
OS Windows 10
User 38401 Photo


Senior Advisor
10,951 posts

Use CSS and use 1em
User 404575 Photo


Registered User
887 posts

Where I'm confused is in the syntax Jo Ann. Do I do this in the style.css file or right there in the page HTML where I want a unique font or color for just one line of text and don't want it to be a <h> tag text?

Melissa Rhiannon
OS Windows 10
User 38401 Photo


Senior Advisor
10,951 posts

You should almost never use it in the HTML page. There are a few exceptions of course for certain scripts and such, but not many things really "need" it in the HTML page. To use it just create your class in the css page (style.css if that's what your page is called). I usually add my various custom code in the bottom area of the page so I know where I added things. In the class you are wanting that to be in you would add the attribute:

font-size: 1em;

you would need that to be within an actual class name for example, I like to sometimes style little spots of text here and there just to add a little color to match the style of the site theme. Maybe I need it to be a little larger so I'll do something like this:

.orange-1em {
color: orange;
font-size: 1em;
}

That tells the page that I want whatever text I put this class in to be colored orange and to be 1em larger than the default text.

You would use this in your html like so:

<p class=orange-1em>Melissa now has orange 1 em text.</p>
which will make the whole sentence orange 1 em

or

<p><span class=orange-1em>Melissa</span> now has orange 1 em text.<p>
which will make only the word Melissa orange and 1 em

Hope that helps :)
User 404575 Photo


Registered User
887 posts

Thanks, I got it now, and all my new pages validate!

Melissa Rhiannon
OS Windows 10
User 38401 Photo


Senior Advisor
10,951 posts

Awesome glad you got it working! Enjoy!
User 404575 Photo


Registered User
887 posts

I got all the pages W3C compliant today!
Melissa Rhiannon
OS Windows 10

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.