Basefont HTML

HTML <basefont> Tag

The HTML <basefont> tag is not supported in HTML5. To specify the default value of font-size, color, and font-family the HTML <basefont> tag is used. The default value is specified for all the contents written within an HTML document. This tag was deprecated in HTML 4. To style the document, CSS can be used instead of the HTML <basefont> tag, as the <basefont> tag is completely removed in HTML 5. The HTML <basefont> element does not contain closing tag but the XHTML <basefont> element does require the closing tag </basefont>.

Syntax:

<basefont color="pink" size="6" face="arial">

Example:

<!DOCTYPE html>
<html>
<head>
<basefont color="blue" size="5">
</head>
<body>
<h1>HELLO WORLD!!</h1>
<p>The HTML basefont tag is not supported in HTML5. And thus, 
there is no change in the text in the output.</p>
</body>
</html>

Output:

Explanation:

In the above example, we can see that there is no effect of the <basefont> tag on the text because the HTML basefont tag is not supported in HTML5.

 

Example: To Use CSS to set the base font.

<!DOCTYPE html>
<html>
<head>
<style>   
h1{
background-color: crimson;  
color: white; }
p{  
color: crimson; }
</style>  
</head>
<body>
<h1>HELLO WORLD!!</h1>
<p>Today is a great day for learning.</p>
</body>
</html>

Output:

Explanation:

In the above example, we are using CSS instead of the HTML <basefont> tag to style the text of the document.

Tag specific attributes:

Attribute Value Uses HTML5
color color To define the default color for the text of the document. Not Supported in HTML5
face font-family To define the default font face for the text of the document. Not Supported in HTML5
size number To define the size of the text of the document. Not Supported in HTML5

Supporting Browsers:

Chrome, IE, Firefox, Opera and Safari do not support the HTML <basefont> tag.

Please Share