About Lesson
Concept and Implementation of the <basefont>
Tag
The <basefont>
tag was once used in HTML to define the default font properties for a webpage. However, it’s essential to note that this tag is no longer supported in HTML5. Modern web development practices recommend using CSS to achieve the same effects that the <basefont>
tag once provided.
What to Use Instead?
Since the <basefont>
tag is obsolete, you can use CSS to specify default text properties for a page. Here are some examples:
Example 1: Specifying a Default Text Color
<!DOCTYPE html>
<html>
<head>
<style>
body {
color: blue;
}
</style>
</head>
<body>
<p>Welcome to aptLearn.io!</p>
</body>
</html>
Example 2: Specifying a Default Font Family
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: jost, sans-serif;
}
</style>
</head>
<body>
<p>Explore coding tutorials at aptLearn.io!</p>
</body>
</html>
Example 3: Specifying a Default Font Size
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-size: 16px;
}
</style>
</head>
<body>
<p>Join our community at aptLearn.io!</p>
</body>
</html>
Try it yourself below
powered by Advanced iFrame. Get the Pro version on CodeCanyon.
Tips
- Use CSS properties like
color
,font-family
, andfont-size
to define default text attributes. - Always prefer modern CSS techniques over deprecated HTML tags to ensure compatibility across browsers.