Open In App
Related Articles

HTML <basefont> Tag

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

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. 

HTML

<!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.

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:

Screenshot-from-2023-07-03-12-44-26.png

HTML basefont Tag

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



Last Updated : 04 Jul, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads