个性化阅读
专注于IT技术分析

HTML font标记(HTML5不支持)

本文概述

HTML <font>标记用于定义其中包含的文本的字体样式。它定义字体大小, 颜色和外观或HTML文档中的文本。

注意:不要使用HTML <font>标记, 因为HTML 5中已弃用该标记, 因此你可以使用CSS属性来更改字体大小, 字体, 颜色等。

句法

<font size=" " color=" " face=" "> Content....</font>

以下是有关HTML <font>标记的一些规范

Display Inline
开始日期/结束日期 开始和结束标签
Usage 字型

例子1

<!DOCTYPE html>
 <html>
 <head>
 <title>Font Tag</title>
 </head>
 <body>
 <h2>Example of font tag</h2>
 <p>This is normal text without any font styling</p>
  <p>
	<font color="blue">Text with normal size and default face</font>
  </p>
  <p>
	<font size="5" color="green">Text with Increased size and default face</font>
  </p>
  <p>
	<font color="red" face="cursive">Text with Changed face</font>
  </p>
</body>
</html>

立即测试

输出:

HTML font标签

使用CSS

使用CSS属性可以达到以下示例中相同的效果:

<!DOCTYPE html>
 <html>
 <head>
 <title>Font Tag</title>
 </head>
 <body>
<h2>Change font using CSS</h2>
 <p>This is normal text without any font styling</p>
 <p style="color: blue;">Text with normal size and default face</p>
 <p style="font-size: 25px; color: green;">Text with Increased size and default face </p>
 <p style="font-family: cursive; color: red;">Text with Changed face</p>
</body>
</html>

立即测试

输出:

HTML font标签

属性

特定于标签的属性

属性 描述
colod rgb(X, X, X)#xxxxx color_name 它指定内容的颜色。 (HTML5不支持)
face font_family 它指定内容的字体。 (HTML5不支持)
size number 它指定内容的大小。 (HTML5不支持)

支持的浏览器

Element Chrome IE Firefox Opera Safari
<font> Yes Yes Yes Yes Yes
赞(0)
未经允许不得转载:srcmini » HTML font标记(HTML5不支持)

评论 抢沙发

评论前必须登录!