HTML font
What would text on the web be if there was no way to style it? Surely, a page would not have much character. Font is an important element on the world wide web. The default appearance of text is not very exciting, but with fonts you can change it by adding much style to your text.
This lesson focuses on:
- The <font> tag
- The <basefont> tag
- Different fonts
- Transition to CSS
The <font> tag
With the <font> tag you can set the size, color, and font of text.
Example:
Output:
The <font> tag is deprecated in HTML 4.01 and above. CSS should be used instead.
The <basefont> tag
The <basefont> tag can be used to specify a general appearance for text on a webpage. It should be placed right after the <body> tag.
NOTE: The <basefont> tag has the same attributes as the <font> tag.
Example:
Output:
NOTE: If you specify a list of fonts with the face attribute like in the above example, the visitor's web browser will use the first font in the list that is available on the visitor's computer. Meaning, if someone is viewing a webpage and their computer does not support the first font you specify, the browser will try the second font and so on until it gets to a font that is supported. This applies to the <basefont> tag as well as the <font> tag.
The <basefont> tag:
- Does not have a closing tag.
- Is deprecated in HTML 4.01 and above (CSS should be used instead)
- Should be used just once in an HTML document
- Does not affect text in headings, tables, or text within <font></font> tags
Different Fonts
There are many different fonts available to use, but it is generally a good idea to use the common ones since those are what most peoples computers support.
Common fonts example:
Output:
Transition to CSS
The <font> tag and <basefont> tag are both deprecated in HTML 4.01 and above. CSS should be used instead.
Of all the tags and attributes that have been deprecated in favor of CSS, the <font> tag and the <basefont> tag are among those whose exit is the most significant. Font is one of those things that is all about styling. Having such tags in HTML is not correct, and the W3C realized this when they deprecated them in favor of CSS.
With the <font> tag, you have to specify text for so many different elements. Imagine what it would be like to have to go and change 5, 10, even 20 different styles manually? Such is the case with the <font> tag.
The <basefont> tag does make things easier. Since it dictates a universal style, it is easier to change things with it when necessary, but still requires editing HTML files.
The transition to CSS allows for a declaration of font styles in a separate language (and no editing of HTML files required). This makes things so much easier for the web developer as changing font styles does not require editing any tags but rather declarations that will affect the font styles of elements which you specify.
If you want to jump right into styling fonts with CSS, read our CSS font properties page.




