HTML <basefont>
Tag Tutorial
The <basefont>
tag is used to specify the base font size, color, and face for text in an HTML document. This tag is no longer supported in HTML5, so it is recommended to use CSS for styling fonts instead. However, it is still useful to understand how this tag works for legacy purposes.
Usage of <basefont>
Tag
The <basefont>
tag is placed within the <head>
section of an HTML document. It can have three attributes: size
, color
, and face
. These attributes allow you to set the default font properties for the entire document.
Attributes of <basefont>
Tag
Attribute | Description |
---|---|
size | Sets the base font size. The value can be a number ranging from 1 to 7, with 3 being the default size. |
color | Sets the base font color. The value can be a color name or a hexadecimal value. |
face | Sets the base font face. The value can be a font family name or a generic font family. |
Example:
Consider an example where we set the base font size to 5, color to red, and face to Arial.
<head>
<basefont size="5" color="red" face="Arial">
</head>
With this <basefont>
tag, the default font size, color, and face for the entire document will be set accordingly.
It is important to note that the <basefont>
tag only affects text within the document that does not have explicit styling applied to it. Any text with specific font properties set using CSS will not be affected by the <basefont>
tag.
Even though the <basefont>
tag is no longer recommended for use in HTML5, understanding its functionality can help when dealing with older HTML documents that still use this tag for font styling.