What is the HTML <basefont> element?
What is the <basefont> element?
The <basefont> element was used in
This tag was depreciated in HTML5 due to the availability of font-family, font, font-size, and font-color.
The <basefont> element is not supported by any browser’s latest version except Internet Explorer (Trident Engine).
HTML <basefont> properties
-
In HTML
<basefont>does not require any closing tags. -
In
XHTMLclosing tags are required. -
It should be included in the
<head>section between the opening and closing tags, i.e.,<head> .. </head>.
Syntax
<basefont color="#FF4433" face="Times New Roman" size="+3" />
Attributes
-
color: Accepts color code in hexadecimal format. -
face: This attribute contains font-family. We can also pass multiple font families; the default will be the first one. -
size: This attribute should be a numeric value between one to seven; the default size will be +3.
In CSS,
font-familyhelps show font in different styles and shapes. Some renowned ones are Arial, Times New Roman, Georgia, Serif, and Helvetica.
Code
The example below should generate font-color #FF4433 and use font-family Times New Roman with size +3 on line 4. But <basefont> does not support HTML5 which is why the font is simple in the code output above.
Using CSS instead of <basefont>
In the example below, we use <style> ... </style> tags in <head> section to include CSS in the HTML file.
Then, we try to change the font color, size, and font face. We apply CSS on <h1> and <p> tags with different attribute values.