Open In App

HTML <basefont> Tag

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: 

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:

HTML basefont tag

Example: Below example illustrates the <basefont> tag in HTML.




<!DOCTYPE html>
<html>
 
<head>
    <title>basefont tag</title>
    <basefont color="red" size="9">
    <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:

HTML basefont Tag

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


Article Tags :