目录 搜索
Attributes accesskey (attribute) class (attribute) contenteditable (attribute) contextmenu (attribute) data-* (attribute) dir (attribute) draggable (attribute) dropzone (attribute) Global attributes hidden (attribute) id (attribute) itemid (attribute) itemprop (attribute) itemref (attribute) itemscope (attribute) itemtype (attribute) lang (attribute) slot (attribute) spellcheck (attribute) style (attribute) tabindex (attribute) title (attribute) translate (attribute) Elements a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 head header hr html i iframe img input input type="button" input type="checkbox" input type="color" input type="date" input type="datetime"-local input type="email" input type="file" input type="hidden" input type="image" input type="month" input type="number" input type="password" input type="radio" input type="range" input type="reset" input type="search" input type="submit" input type="tel" input type="text" input type="time" input type="url" input type="week" ins kbd label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt rtc ruby s samp script section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr Miscellaneous Attributes Block-level elements CORS enabled image CORS settings attributes Element Inline elements Kinds of HTML content Link types Microdata Optimizing your pages for speculative parsing Preloading content Reference Supported media formats Using the application cache Obsolete acronym applet basefont big blink center command content dir element font frame frameset hgroup image input type="datetime" isindex keygen listing marquee nextid noframes plaintext strike tt xmp
文字

已废弃

该特性已经从 Web 标准中删除,虽然一些浏览器目前仍然支持它,但也许会在未来的某个时间停止支持,请尽量不要使用该特性。

HTML Font 元素<font>)定义了该内容的字体大小、顏色与表现。

注意:

不要使用这个元素!尽管它在 HTML 3.2 规范化,但在 HTML 4.01 中已废除,因为该元件只和样式相关,接着在 HTML5 过时。

从 HTML 4 开始,HTML 不能在<style>元素,或各元素style属性以外,表现任何样式信息。今后的网页开发,样式只能使用CSS来编写。

<font>元素的行为,可以通过CSS属性实现,以及更好控制。

属性

如同其他 HTML 元素,这个元素支持全局属性。

color这个属性使用颜色名称或是十六进制的 #RRGGBB 格式,来设置文字的颜色。

face这个属性列出了一个或多个逗号分隔的字体名称。 默认样式中的文档文字,会使用客户端浏览器所支持的,第一个字体风格来渲染。如果本地系统中并没有安装列出的字体,浏览器会使用系统预设的均衡(proportional)或等宽(fixed-width)字体。

size这个属性使用数字或相对值指定文字大小。数字在最小的7到最大的7之间,默认值为3。也可以用诸如+2或-3的相对值指定,这会将其设置为,相对于<basefont>元素size属性的值,或者如果不存在,则是相对于3也就是默认值的值。

DOM 接口

这个元素实现了HTMLFontElement接口。

浏览器兼容性

Feature

Chrome

Edge

Firefox

Internet Explorer

Opera

Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

color

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

face

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

size

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

Feature

Android

Chrome for Android

Edge mobile

Firefox for Android

IE mobile

Opera Android

iOS Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

color

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

face

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

size

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

上一篇: 下一篇: