Learning HTML 3.2 by Examples, section 5 Descriptions of HTML 3.2 tags:

FONT - font size and color (Not in HTML 2.0!)


To specify font size (relatively to other sizes) or font color or both.

Typical rendering

The actual font size and color used to present the contents of the FONT element may be affected, but it depends on the browser; see general notes on rendering markup.

A browser may provide a user option for defining which font is to be used and which physical font size shall be used to correspond to the default font size (3) in HTML. Setting the font size in HTML may decrease or increase the actual font size used, in a browser dependent manner.

Basic syntax

<FONT SIZE=n>text</FONT>


<FONT COLOR=colorspec>text</FONT>

Possible attributes

attribute name possible values meaning notes
SIZE string size of the font, either a number in the range 1 - 7 or a signed integer like "+1" or "-2" signed value is added to the current base font size as set by BASEFONT to produce a size number in the range 1 - 7
COLOR color specification color to be used for the contents might clash with background color!

Several browsers also support a FACE attribute which accepts a comma separated list of font names in order of preference. This is used to search for an installed font with the corresponding name. This attribute was made official, though deprecated, in HTML 4.

Allowed context

Text container, i.e. any element that may contain text elements. This includes most HTML elements. In particular, text elements can be nested.


Text elements.


Example FONT-1.html:

This is some text <FONT SIZE=-1>including text which may appear
in a smaller font</FONT>.
This is an attempt to present one
<B><U><FONT SIZE=7 COLOR=RED>word</FONT></U></B>
very prominently: in bold face, underlined, in the largest font
available, and in red.


Avoid using FONT, for reasons explained in the discussion of text markup in general. In HTML 4.0, the FONT element is deprecated in favor of style sheets. (As regards to criticism of FONT in particular, see Warren Steel's What's wrong with the <FONT> element?.) Specifically, if you need to change font sizes, try to live with SMALL and BIG only.

Use BASEFONT to set font size for a large part of the document. (Notice that paragraph breaks are not allowed within FONT.)

The attributes in the BODY tag can be used to set the background color or the default text font color or both. Of course you should not use the background color for text!

A browser need not implement FONT so that SIZE values 1 - 7 all correspond to different font sizes. Some versions of Internet Explorer and Netscape have mapped those values to physical sizes e.g. so that sizes 4 and 5, or sizes 2 and 3, are equal to each other. The trend is that browsers nowadays try to map them all to different sizes. On the other hand, browsers generally have an option like "ignore font sizes specified in documents", which is useful e.g. against pages which cluelessly set the size of all text to 2 or 4. In character cell browsers such as Lynx, a SIZE attribute has no effect, of course.

You may wish to use a separate file for checking the visual appearance of the different markup elements on your browser to see how it displays different font sizes. Consult information about color specifications for color samples, or a separate file containing text in 16 colors corresponding to the predefined color names.

There are two kinds of relativity involved in font sizes. First, in HTML we refer to font sizes with numbers in the range 1 - 7 which are in some browser and device dependent manner mapped to physical sizes (expressed e.g. in pixels, points or millimeters). The mapping is usually not linear; you should not assume that e.g. font size 3 is half of font size 6. Second, the way in which the font size (in the HTML meaning) is specified in the SIZE attribute can be relative; for instance, SIZE="+1" (which is quite different from SIZE="1" or SIZE=1) means the current base font size plus one, and the sum itself is relative in the sense explained above.

It seems that the first public document describing the FONT tag was an anonymous post titled MCOM html extensions, describing Netscape's plans; it was sent to the Usenet group comp.infosystems.www.misc in 1994-11-12.

Date of last update: 2010-12-16.
This page belongs to the free information site IT and communication, section Web authoring and surfing, by Jukka "Yucca" Korpela.