Syntax | This element uses separate opening and closing tags.<font>...</font> |
---|---|
Usage | The <font> tag is used to specify the text font size, color and font name. The text is placed between the opening and closing font tags. |
Content Model | The <font> element can contain the following tags, and Text, between its opening and closing tags. <a>
<abbr>
<acronym>
<applet>
<b>
<basefont>
<bdo>
<big>
<br>
<button>
<cite>
<code>
<del>
<dfn>
<em>
<font>
<i>
<iframe>1
<img>
<input>
<ins>
<kbd>
<label>
<map>
<object>
<q>
<s>
<samp>
<script>
<select>
<small>
<span>
<strike>
<strong>
<sub>
<sup>
<textarea>
<tt>
<u>
<var>
Notes:1. The <font> element can contain the <iframe> tag when using DTD Transitional and Frameset documents but not Strict documents. 2. Red tags have been deprecated and are allowed in DTD Transitional and Frameset documents but not Strict documents. |
Required | Tag Specific | Core | Focus | Events | Language |
---|---|---|---|---|---|
color face size | id class style title | dir lang xml:lang1 | |||
Notes: 1. XHTML only. |
Attribute | Description |
---|---|
color | The color attribute is used to specify the color of the text. The color value can be expressed as an sRGB value which is a hash (#) symbol followed by a hexadecimal value. Or, the color value can be expressed as a color name. Color names are black, silver, gray, white, maroon, red, purple, fuchsia, green, lime, olive, yellow, navy, blue, teal, or aqua. HTML & XHTML <font> tag example using sRGB color value. <font size="4" color="#FF0000" face="Courier New, Courier, monospace">
This text has the size, color, and font specified with the font tag.
</font> HTML & XHTML <font> tag example using color name value. <font size="4" color="green" face="Courier New, Courier, monospace">
This text has the size, color, and font specified with the font tag.
</font> Note: This attribute has been deprecated. |
face | The face attribute is used to specify the font family by using a comma separated list of font names. HTML & XHTML <font> tag example using sRGB color value. <font size="4" color="#FF0000" face="Courier New, Courier, monospace">
This text has the size, color, and font specified with the font tag.
</font> Note: This attribute has been deprecated. |
size | The size attribute is used to specify the text font size using an integer value between 1 and 7. HTML & XHTML <font> tag example using sRGB color value. <font size="4" color="#FF0000" face="Courier New, Courier, monospace">
This text has the size, color, and font specified with the font tag.
</font> Note: This attribute has been deprecated. |
id | The id attribute assigns a unique name to a tag. This allows style sheets or scripts to reference the tag. See id Example |
class | The class attribute assigns a class name to a tag. The class name does not need to be unique. More than one tag can have the same class name. This allows style sheets or scripts to reference multiple tags with a single class name. See class Example |
style | The style attribute specifies styles for the tag. For Cascading Style Sheets (CSS), the syntax is name:value. Each name:value pair is separated by semicolons. See style Example |
title | The title attribute specifies additional information about the tag. It is common for browsers to display the title when the pointing device stops over the object. See title Example |
dir | The dir attribute tells the browser whether the text should be displayed from left-to-right or right-to-left. It does not reverse the direction of the characters, like the <bdo> tag does, but it can help the browser to determine if the text should be aligned on the left side or the right side. See dir Example |
lang | The lang attribute specifies a language. This attribute can help the browser to correctly display text. This attribute can also be useful for braille translation software, speech synthesizers, dictionary definitions, etc. See lang Example |
xml:lang | The xml:lang attribute specifies a language for XHTML documents. This attribute can help the browser to correctly display text. This attribute can also be useful for braille translation software, speech synthesizers, dictionary definitions, etc. See xml:lang Example Note: XHTML only. |
<font> tag example using sRGB color value. <font> tag example using color name value. |