HTML <basefont> Tag
Last Updated :
23 Aug, 2024
Improve
The <basefont> tag in HTML is used to set the default text-color, font-size, font-family of all the text in the browser. It is no longer supported in HTML5. So, as an alternative, we are using CSS in the code example. The <basefont> tag was supported in Internet Explorer 9, and earlier versions.
Syntax:
<basefont attributes...>
Attributes: This tag contains three optional attributes which are listed below:
- color: It is used to specify the default text-color of the document.
- size: It is used to specify the default font-size of the document.
- face: It is used to specify the default font-style of the document.
Example: This example illustrates the alternative of <basefont> tag by using the available CSS properties.
<!DOCTYPE html>
<html>
<head>
<title>Alternative of basefont tag</title>
<style>
body {
text-align: center;
}
.gfg {
color: green;
font-size: 45px;
font-family: sans-serif;
}
.geeks {
font-family: arial;
}
</style>
</head>
<body>
<div class="gfg">GeeksforGeeks</div>
<div class="geeks">
A Computer Science portal for geeks.
It contains well written, well thought
and well explained computer science and
programming articles.
</div>
</body>
</html>
Output:

Example: Below example illustrates the <basefont> tag in HTML.
<!DOCTYPE html>
<html>
<head>
<title>basefont tag</title>
<basefont color="red" size="9"></basefont>
<style>
body {
text-align: center;
}
.gfg {
font-size: 40px;
font-weight: bold;
color: green;
}
.geeks {
font-size: 25px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="gfg">GeeksforGeeks</div>
<div class="geeks">basefont Tag</div>
<p>A computer science portal for geeks</p>
</body>
</html>
Output:

Supported Browsers: This tag is not supported by any browser, except Internet Explorer with the 11.0 version or lower versions.