HTML Basefont Tag
The <basefont> tag is deprecated in HTML 4.01 and completely removed in HTML5.
It is supported in Internet Explorer 9, and earlier versions.
It’s no longer recommended for use.
The <basefont> tag sets a default font style for the entire webpage. Once you define it, the font face, size, and color you choose will apply to all the text that follows — unless it's overridden by another tag like <font> or a CSS style.
Syntax -
<basefont face="Arial" size="4" color="blue">
Attribute | Description |
---|---|
color | Sets the font color (name or hex code like #ff0000) |
face | Sets the font type (e.g., Arial, Verdana) |
size | Sets the font size (from 1 to 7). The range of accepted values is from 1(smallest) to 7(largest). The default size of a font is 3. |
Example -
Scenario - Example Using <basefont> Tag
<!DOCTYPE html>
<html>
<head>
<title>Basefont tag example.. </title>
</head>
<body>
<basefont face="verdana" color="green" size="1">Font
example output display with color green and of size=1</basefont>
<p> basefont tag is not supported in any browser.
Use CSS instead.</p>
</body>
</html>
Output -
Modern Alternative Using CSS -
Scenario - Instead of using <basefont>, here’s how we do the same thing today with CSS:
<!DOCTYPE html>
<html>
<head>
<title>Basefont tag example.. </title>
<style>
.example {
font-family: Arial;
font-size: 16px;
color: green;
}
</style>
</head>
<body>
<h4 class="example">This is the modern way to
style fonts</h4>
<p class="example">CSS is now the standard for
handling text appearance on web pages.</p>
</body>
</html>
Output -
This is the modern way to style fonts
CSS is now the standard for handling text appearance on web pages.