Skip to content
Related Articles

Related Articles

HTML <basefont> Tag

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 17 Mar, 2022

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 alternate, 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:

HTML <basefont> tag

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


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!