<font>

The <font> element was used to set the font characteristics of a text. It is now deprecated. Some CSS properties like the font property should be used instead.

Syntax

At least one of the following three attributes is required for the <font> element. However, any combination of them can be used:

  • color: What color the font/text should be. The color can be set to a named color, hexadecimal or RGB.
  • face: What font the text should be. For example, to have the text be verdana, the face attribute would be set to face="verdana".
  • size: Sets the size of the font/text. It can use absolute units and relative units ranging from 1-7. Absolute units are used by size="5" or any other number 1-7. Relative units are relative the size of the <basefont> element which is also deprecated. The attribute would look something like this size="+5".

Example

<font color="pink">This text is pink</font>
<font size="5">This size is 5</font>
<font face="verdana">This text is in verdana font</font>

Output of the font tag example

Edit this page on GitHub

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your feedback form.

Learn HTML on Codecademy