Skip to: content, navigation

by Ian Lloyd

size (HTML attribute)

Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full
Spec
Depr. Version
Yes HTML 2
size="number"

Example

The first set of examples below show the seven font sizes available (with the default font size alongside each by way of comparison):

<p>Default font size <font size="1">Font size 1</font></p>
<p>Default font size <font size="2">Font size 2</font></p>
<p>Default font size <font size="3">Font size 3</font></p>
<p>Default font size <font size="4">Font size 4</font></p>
<p>Default font size <font size="5">Font size 5</font></p>
<p>Default font size <font size="6">Font size 6</font></p>
<p>Default font size <font size="7">Font size 7</font></p>

And here’s how this looks:

Example of seven font sizes

To increase or decrease text sizes by increments, you could use the following:

<p>This is normal font and <font size="+2">this is two sizes
up</font>. This, on the other hand, is <font size="-2">two sizes
down</font>.</p>

And the effect can be seen as shown below:

Example of font sized up and down

Description

The size attribute is used to bump the font size of text contained inside the font element up or down, or to a predefined size. The old font sizes provided with earlier HTML versions ranged from 1 to 7, with font size 3 being the default. It is possible to set a size up or down by using the + or - character, as shown in the examples below.

Value

The following values are acceptable:

  • 1, 2, 3, 4, 5, 6, 7
  • +1, +2, +3, +4, +5, +6
  • -1, -2, -3, -4, -5, -6

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

Causes no compatibility issues. It has excellent support across all tested browsers.

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters