HTML face Attribute
The obsolete HTML face attribute was historically used to specify the typeface used to display text, most commonly with the obsolete <font> and <basefont> elements.
face attribute is obsolete and should not be used in modern HTML. Use the CSS font-family property to specify fonts instead.
Historical Syntax
The face attribute could specify a single font family:
<font face="Arial">This text uses Arial.</font>
Authors could also provide a comma-separated list of preferred fonts:
<font face="Verdana, Arial, sans-serif">
Example text
</font>
The browser could try the fonts in order and use an available alternative when an earlier choice was unavailable.
Historical Elements
The face attribute was historically associated with elements used to control font presentation.
| Element | Historical Purpose |
|---|---|
<font> |
Specified the typeface used for the text contained within the element. |
<basefont> |
Historically specified a default typeface for text in the document. |
Historical Use
Before CSS became the standard method for controlling typography, HTML included presentational elements and attributes that allowed authors to change the appearance of text directly in the markup.
The face attribute let authors request a particular typeface. Because a requested font might not be installed on every user's computer, authors could provide several font names as alternatives.
This approach mixed typography with the document's content and structure. A website that repeated face attributes throughout its pages could require many HTML changes when its typography was updated.
Why It Became Obsolete
The face attribute became obsolete as CSS took over responsibility for presentation. CSS provides more flexible and maintainable control over typography without placing font choices directly in the HTML content.
A single CSS rule can apply a font family to many elements or an entire website. CSS also provides properties for font size, weight, style, line height, spacing, and other typographic features.
Modern Alternative
Use the CSS font-family property instead of the obsolete HTML face attribute.
Historical HTML
<font face="Georgia, Times New Roman, serif">
Example text
</font>
Modern HTML and CSS
<p class="example-font">Example text</p>
<style>
.example-font {
font-family: Georgia, "Times New Roman", serif;
}
</style>
The font-family property can contain a prioritized list of font families. The browser tries each family in order until it finds one that is available.
Font family names containing spaces, such as Times New Roman, are commonly placed inside quotation marks. A generic family such as serif or sans-serif can be placed at the end of the list as a final fallback.
Learn More About CSS Fonts
The CSS tutorials explain how modern webpages control font families and other typography settings:
- CSS Font Family - Learn how to specify preferred fonts and fallback font families.
Legacy Browser Support
The face attribute was widely recognized by older browsers when used with the obsolete <font> element. Browsers generally attempted to use the requested font when it was available on the user's system.
Modern browsers may continue to render old <font face="..."> markup for compatibility with legacy webpages, but the attribute should not be used when creating or updating modern HTML.
For additional information about historical browser compatibility, visit Can I Use? . Search for the HTML element or attribute you want to check. Search results can include related HTML features, element attributes, APIs, and other technologies, so select the result that most closely matches the legacy feature you are researching.
Related Attributes
Other obsolete HTML attributes historically used to control text presentation include:
color- Historically used to specify text color with presentational HTML.
Specifications
The face attribute is obsolete and font selection should be controlled with CSS. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.
