Skip to content
Related Articles

Related Articles

Improve Article

HTML <basefont> Tag

  • Last Updated : 17 Sep, 2021

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:

The <basefont> tag 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: 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: 
 

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

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :