The <basefont>
tag was used in older versions of HTML (prior to HTML5) to set a default font size, color, and face for all text in a document.
🕰️ Syntax (Old HTML)
<basefont size="4" color="blue" face="Arial">
This would set:
size
— font size (1 to 7)color
— font colorface
— font family (like Arial, Verdana, etc.)
🛑 Why You Shouldn’t Use It
- It’s not supported in HTML5.
- It breaks semantic structure and separates content from style.
- It has been replaced by CSS, which is much more powerful and flexible.
✅ Modern Alternative (CSS)
Instead of <basefont>
, use CSS to set default styles for the <body>
or text elements:
<!DOCTYPE html>
<html lang="en">
<head>
<style>
body {
font-size: 16px;
color: blue;
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<p>This is styled with CSS, not basefont.</p>
</body>
</html>
Summary
Feature | <basefont> | CSS Alternative |
---|---|---|
Font Size | size="3" | font-size: 16px; |
Font Color | color="red" | color: red; |
Font Face | face="Verdana" | font-family: Verdana; |
✅ Use CSS. Avoid <basefont>
.
If you’re working on a modern website or application, stick to HTML5 and CSS for all styling. The <basefont>
tag exists now only for legacy support.
Would you like a styled example with modern CSS to replace old <basefont>
usage? I can create one for you.