HTML <font>标签(HTML5不支持)
HTML <font>标签(HTML5中不支持)
HTML <font>标签用于定义其中包含的文本的字体样式。它定义字体大小,颜色和外观或HTML文档中的文本。
注意:注意:不要使用HTML <font>标签,因为它已在HTML5中弃用,因此您可以使用CSS属性来更改字体大小,字体,颜色等。
语法
<font size=" " color=" " face=" ">....</font>
以下是有关HTML <font>标签的一些规范
显示 |
内联 |
开始标签/结束标签 |
开始标签和结束标签 |
用法 |
字体样式 |
示例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>
输出:
使用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>
输出:
属性
标签专用属性
属性 |
值 |
说明 |
color |
rgb(X,X,X) #xxxxx color_name |
它指定内容的颜色。 (HTML5不支持) |
face |
font_family |
它指定内容的字体。 (HTML5不支持) |
size |
number |
它指定内容的大小。 (HTML5不支持) |
支持浏览器