Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

Using fonts

You use the <font> tag to control control (more or less) the fonts on your page. You can:

  • Set the font face. For example, arial, courier, helvetica, verdana, comic sans ms. There are plenty to choose from but if users don't have the font, they’ll probably see the text in Times Roman
  • Set the font size. Not quite as straight forward as in a word processor; you can't specify a point size (10pt, 12pt). You specify a fixed size in the range 1 to 7 or a relative size to a base font (set with the <basefont> tag)
  • Change the font colour. One of the 16 VGA colours is safest

To change any of the font attributes, simply use the <font> tag. The text that follows will remain changed until you close with the </font> tag.

You can change any or all of the font attributes at the one time; just include all the required changes in the <font> tag:

<font face="Comic Sans MS" color="red" size="+2">

As with other character formatting tags, some tags do not accept the effect of <font>. For example, table tags accept changes to the font's name but not to the size.

It isn't very efficient to have <font> tags all over your page. It is much better to use a style sheet (either linked or embedded) to set the font properties that you want for a tag. The <font> tag is also likely to disappear from the HTML specification in the future so you'll have to use a style sheet.