<basefont>

HTML <basefont> Tag

The <basefont> tag specifies the default font size and color of the text. It can be used several times inside the <head> or <body> tags.

The <basefont> is a deprecated HTML tag and not supported in HTML5.

Syntax

Syntax (语法)

The <basefont> tag is empty, which means that the closing tag isn’t required. But in XHTML, the (<basefont>) tag must be closed (<basefont/>).

Example of the HTML <basefont> tag:

<!DOCTYPE html>
<html>
 <head>
   <title>Title of the documnet</title>
   <basefont color="green" face="Helvetica" size="14">
 </head>
 <body>
   <h3>Title of the text.</h3>
   <p>Paragraph of the text.</p>
 </body>
</html>

To achieve the former behavior of the <basefont> use CSS font, font-family, font-size and color properties.

Example of the HTML <basefont> tag with CSS properties:

<!DOCTYPE html>
<html>
 <head>
   <title>Title of the document</title>
   <style>
     body {
       color: #8ebf42; 
       font-size: 14px;
       font-family: Helvetica;
     }
   </style>
 </head>
 <body>
   <h3>Title of the text.</h3>
   <p>Paragraph of the text.</p>
 </body>
</html>

Result

Attributes

Attributes (属性)

AttributeValueDescription
colorcolorSets the default text color.
Not supported in HTML5.
facefont_familyDefines the font of the text.
Not supported in HTML5.
sizenumberSpecifies the font size.
Not supported in HTML5.


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部