1

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

3
  • 2
    I guess WHY is the question. FONT has been deprecated and should not be used. Commented Jul 23, 2013 at 20:59
  • First, say span class="size2" instead of font size="2" in the HTML. Then, use CSS .size2 { font-size: 10pt; } and similar for size 3. However, you need to use points for CSS. Generally, size 2 is 10pt and size 3 is 12pt. microsoft.com/typography/web/designer/face3.htm Commented Jul 23, 2013 at 21:00
  • By the way, font is long obsolete. Steer way clear of it; it's harder to write something the right way once than rewrite it. Commented Jul 23, 2013 at 21:02

3 Answers 3

3

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

Sign up to request clarification or add additional context in comments.

Comments

1

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;
}

Comments

0

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 :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.