How to define CSS font size within font tags?

I have written all my HTML code using the font tag. I used size="2" and size="3"

Is it possible to define a main CSS style in which I define the sizes for these fonts?

<font size="2">Hello 1</font>
<font size="3">Hello 2</font>

Thanks a lot guys

Upvotes: 1

Views: 143

Answers (3)

Actually FONT tag has been deprecated and should not be used. It's not supported in HTML5, though I had already written a huge piece of code using such tags.

Thanks a lot guys :)

Upvotes: 0

Ryan Sparks
Ryan Sparks

Reputation: 309

First of all, <font> is obsolete.

Second of all, yes, you can! Although I'd recommend not using the size attribute. With span, I'd recommend using something like class="small". Set the size by using the following code:

span.small
{
    font-size: 14px;
}

Upvotes: 1

Lorenzo Marcon
Lorenzo Marcon

Reputation: 8179

Of course you can. Try adding this to a css style included in your page:

font[size="2"] {
   font-size: 20px;
}

font[size="3"] {
   font-size: 30px;
}

Naturally you have to choose the size you prefer. By the way, the <font> tag is obsolete, and you should not use it. Use <span> and assign it a class, instead.

Further reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/font

Upvotes: 3

Related Questions