DEV Community

Share Point Anchor
Share Point Anchor

Posted on • Originally published at sharepointanchor.com on

HTML <basefont> Basefont Tag

In HTML, the Basefont tag sets a default text-color, font-size, font-family of all the text in the browser. This tag can be used several times inside the or tag.

Note: The tag is a deprecated HTML tag , and it is not supported in HTML 5.

The main purpose of this tag is to specify the default font size and color of the text. This base font is applied to complete document.

Syntax:

The tag does not contain a close tag in HTML. But in XHTML it has both opening tag and closing tag.


<basefont color="blue" face="Verdana" size="14" >

Enter fullscreen mode Exit fullscreen mode

Sample of the HTML Tag:


<!DOCTYPE html>
<html>
  <head>
    <title>Title = Basefont Tag</title>
    <basefont color="green" face="Verdana" size="14">
  </head>
  <body>
    <h3>This is the Title of the Document</h3>
    <p>This is the sample paragraph.</p>
  </body>
</html>

Enter fullscreen mode Exit fullscreen mode

Result:

Result

The tag is forbidden in the updated version of Google Chrome. Because, the new version of browsers has its own pre-built font size and color. So from the above result, the tag was not executable.

To achieve the former behavior of the tag , you can use the CSS properties of font , font-size , font-family and color properties.

Sample of the HTML tag with CSS Properties:


<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      body {
        color: #0E9FBC; 
        font-size: 14px;
        font-family: Verdana;
      }
    </style>
  </head>
  <body>
    <h3>Title of the text.</h3>
    <p>Paragraph of the text.</p>
  </body>
</html>

Enter fullscreen mode Exit fullscreen mode

Result:

Result

Attributes:

The tag supports the global attributes and the event attributes. You can use the following properties to style an HTML basefont tag.

Attribute Value Description
color color This attribute will set the default text color. (It is not supported in HTML 5 )
face font_family It helps to define the font of the text. (Now it it not supported in HTML 5 )
size number Helps to specify the font size. (It is not supported in HTML 5 )
Attributes

Browser Support:

Browser Support

Related Articles:

The post HTML Basefont Tag appeared first on Share Point Anchor.

Top comments (0)