ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 5 January 1998

7.2 FONT Element

Netscape Version 2.0 introduced the FONT element to permit control of the size of the displayed font, when possible. Font sizes are defined in a range from 1 to 7 (the default base value, or basefont, is 3). You can then specify a change in font size using elements such as.

<P> This is <FONT SIZE=+2>resized</FONT> text.   <BR>
  This is <FONT SIZE=-2>resized</FONT> text.   <BR>
  This is <FONT SIZE=7>resized</FONT> text.   </P>

which is rendered as:

This is resized text.
This is resized text.
This is resized text.

You can specify the font size relative to the current size (using + or -) or as an absolute size from 1 to 7.

7.2.1 Microsoft/Netscape Enhancement

In Internet Explorer 3, Microsoft introduced the FACE attribute, for specifying the typeface. For example "FACE="arial" would specify an arial font. This attribute is supported by most browser vendors. The face names are usually taken from the Windows font manager, so you need to know the font names and have the fonts installed for this to work. Clearly this will only work on machines that have the fonts installed locally.

Multiple fonts can be specified, separated by a comma -- the browser looks through the font list, and chooses the first one it finds on the local system. For example, FACE="arial,helvetica,times" will first try arial, then helvetica if arial is not present, and finally try times-roman. Here are some examples:

<P> This is <FONT FACE="arial,helvetica">different font</FONT> text.   <BR>
  This is <FONT FACE="times,helvetica">different font</FONT> text.   <BR>
  This is <FONT FACE="zapf,times">different font</FONT> text.     </P>

which is rendered as:

This is different font text.
This is different font text.
This is different font text.

7.2.2 Additional Enhancements

Font color can also be controlled, using a COLOR attribute. For example, COLOR="red" or COLOR="#ff0000" requests red text font. There are severla supported color names, but to safe it is best to use RGB color codes, as in COLOR="#RRGGBB". Here are some examples:

<P> This is <FONT color="red">different color</FONT> text.   <BR>
  This is <FONT COLOR="#33FF66">different color</FONT> text.   </P>

which is rendered as:

This is different color text.
This is different color text.


ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 5 January 1998