<basefont>

Christine_Yang's avatar
Published Jul 1, 2022Updated Jul 31, 2023
Contribute to Docs

The <basefont> element was used to set the default font characteristics for the text of an HTML document.

Note: This is now deprecated, CSS properties like the font property should be used instead. To set the font of specific parts of the webpage, the <font> element would be used in combination with the <basefont> element.

Syntax

<basefont> must be a child of the element. Any combination of the following three attributes could be used in the <font> element, with at least one being required:

  • color: Sets the color for the font/text using a named color, hexadecimal, or RGB.
  • face: Sets the font for the text (e.g., face="verdana").
  • size: Sets the size of the font/text using absolute units ranging from 1-7 (e.g., size="5").

Example

<html>
<head>
<basefont size="5" font="verdana" color="green" />
</head>
<body>
<p>
This text should be size 5 the font should be verdana and the color should
be green.
</p>
</body>
</html>

Output of the basefont tag example

All contributors

Contribute to Docs

Learn HTML on Codecademy