Controlling the font size with the <font> tag

Occasionally, you may change the appearance of text for extra emphasis. For example, you may make the text bold, a heading, or just increase its size than the surronding text. This page explains how to use the <font> tag to control the font size.

To control font size, use a font size value of 1 - 7, where font 1 is the smallest and 7 is the largest. Listing 1 shows the HTML code and the corresponding 7 different font sizes.

Listing 1 HTML code and different font sizes
HTML code Output
<font size="1">size 1</font> size 1
<font size="2">size 2</font> size 2
<font size="3">size 3</font> size 3
<font size="4">size 4</font> size 4
<font size="5">size 5</font> size 5
<font size="6">size 6</font> size 6
<font size="7">size 7</font> size 7

Notice to control the size of the font, we used the size attribute. An attribute adds an extra instruction to the tag with the specified value. Thus an attribute consists of the name of the attribute and a value. For instance, in the first example in listing 1, size is an attribute and the value is 1.