HTML <font> 标签
HTML5 中不支持
<font> 标签在 HTML 4 中用于指定字体、字体大小和文本颜色。
定义和用法
<font> 规定文本的字体、字体尺寸、字体颜色。
实例
规定文本字体、大小和颜色:
<font size="3" color="red">This is some text!</font>
<font size="2" color="blue">This is some text!</font>
<font face="verdana" color="green">This is some text!</font>
浏览器支持
| 元素 |  |  |  |  |  | 
|---|---|---|---|---|---|
| <font> | Yes | Yes | Yes | Yes | Yes | 
所有主流浏览器都支持 <font> 标签。
HTML 与 XHTML 之间的差异
在 HTML 4.01 中,font 元素不被赞成使用。
在 XHTML 1.0 Strict DTD 中,font 元素不被支持。
提示和注释:
提示:请使用样式(代替 <font>)来定义文本的字体、字体颜色、字体尺寸。
可选的属性
| 属性 | 值 | 描述 | 
|---|---|---|
| color | rgb(x,x,x) #xxxxxx colorname | 不赞成使用。请使用样式取代它。 规定文本的颜色。 | 
| face | font_family | 不赞成使用。请使用样式取代它。 文本的字体。 | 
| size | number | 不赞成使用。请使用样式取代它。 规定文本的大小。 | 
标准属性
id, class, title, style, dir, lang, xml:lang 如需完整的描述,请访问标准属性。
事件属性
NONE 如需完整的描述,请访问事件属性。
TIY 实例
设置文字的字体
本例演示如何设置文字的字体。
<h1 style="font-family:verdana">A heading</h1>
<p style="font-family:courier">A paragraph</p>
设置文字的尺寸
本例演示如何设置文字的尺寸。
<h1 style="font-size:150%">A heading</h1>
<p style="font-size:80%">A paragraph</p>
设置文字的颜色
本例演示如何设置文字的颜色。
<h1 style="color:blue">A heading</h1>
<p style="color:red">A paragraph</p>
设置文字的字体、字体尺寸、字体颜色
本例演示如何设置文字的字体、字体尺寸、字体颜色。
<p style="font-family:verdana;font-size:80%;color:green">
This is a paragraph with some text in it. This is a paragraph with some text in it. This is a paragraph with some text in it. This is a paragraph with some text in it.
</p>
 我的书签
 我的书签
                                 添加书签
 添加书签 移除书签
 移除书签