Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html
basefont
font
html4
communitycreator

What is the HTML <basefont> element?

AKASH BAJWA

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

What is the <basefont> element?

The <basefont> element was used in HTML4Hypertext Markup Language 4.0v to set the default font family, font size, and font color.

This tag was depreciated in HTML5 due to the availability of CSSCascade Style Sheets font properties like 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 XHTML closing 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-family helps 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.

  • HTML

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.

  • HTML
  • CSS

RELATED TAGS

html
basefont
font
html4
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring