HTML: <basefont> tag
This HTML tutorial explains how to use the HTML element called the <basefont> tag with syntax and examples.
Description
The HTML <basefont> tag defines the default font-family, font-size and color for the text in the HTML document. Since this tag was removed in HTML5, it is recommended that you use CSS properties such as font, font-family, font-size and color to format the text in the document. This tag is also commonly referred to as the <basefont> element.
Syntax
In HTML, the syntax for the <basefont> tag is: (example that defines the base font as red, uses to the font-family Verdana, Geneva, sans-serif and has a size of 12)
<head>
<basefont color="red" face="Verdana, Geneva, sans-serif" size="12">
</head>
Attributes
In addition to the Global Attributes, the following is a list of attributes that are specific to the <basefont> tag:
Attribute | Description |
---|---|
color | Color of text in either hexadecimal (ie: #RRGGBB format) or named color (ie: black, red, white) |
face | Font to use for text. Listed as one or more font names (comma separated) |
size | Font size expressed as either a numeric or relative value. Numeric values range from 1 to 7 (1 is the smallest, 7 is the largest, 3 is the default). Relative values can be values such as +1 or -2, increasing by one font size or decreasing by 2 font sizes, respectively. |
Note
- The HTML <basefont> element is found within the <head> tag.
- The <basefont> tag is obsolete in HTML5. Use CSS instead to format the text. The CSS equivalents would be color, font, font-family, font-size, etc.
Browser Compatibility
The <basefont> tag has basic support with the following browsers:
- Internet Explorer (IE)
- Edge
- Edge Mobile
Example
We will discuss the <basefont> tag below, exploring examples of how to use the <basefont> tag in HTML5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.
Advertisements