Commentper-character fallback does work in IE7+ [http://www.browserstack.com/issue-tracker/eaaf7e91cf7fae49f032cd78c2a02bbbea8519cb/winxp_IE_7.0.jpg vs http://www.browserstack.com/issue-tracker/d9a06e8cc15a83ea9704c2a91f95e8917972d793/winxp_IE_6.0.jpg]

Revision Content

{{CSSRef}}

Summary

The font-family CSS property allows for a prioritized list of font family names and/or generic family names to be specified for the selected element. Unlike most other CSS properties, values are separated by a comma to indicate that they are alternatives. The browser will select the first font on the list that is installed on the computer, or that can be downloaded using the information provided by a {{cssxref("@font-face")}} at-rule.

Web authors should always add at least one generic family in a font-family list, since there's no guarantee that a specific font is installed on the computer or can be downloaded using a {{cssxref("@font-face")}} at-rule. The generic family lets the browser select an acceptable fallback font when needed.

It is often convenient to use the shorthand property {{cssxref("font")}} to set font-size and other font related properties all at once.

Note: The font-family property specifies a list of fonts, from highest priority to lowest. Font selection does not simply stop at the first font named in the list that is on the user's system. Rather, font selection is done one character at a time, so that if an available font does not have a glyph that can display a character needed, the later available fonts are tried. However, this doesn't work in Internet Explorer 6 or earlier.

When a font is only available in some styles, variants, or sizes, those properties may also influence which font family is chosen.

Values

<family-name>

The name of a font family. For example, "Times" and "Helvetica" are font families. Font family names containing whitespace should be quoted.

<generic-name>

Generic font families are a fallback mechanism, a means of preserving some of the style sheet author's intent in case when none of the specified fonts are available. Generic family names are keywords and must not be quoted. A generic font family should be the a last alternative in the list of font family names.

Glyphs in cursive fonts generally have either joining strokes or other cursive characteristics beyond those of italic typefaces. The glyphs are partially or completely connected, and the result looks more like handwritten pen or brush writing than printed letterwork.

Valid family names

Font family names must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This means that punctuation characters and digits at the start of each token must be escaped in unquoted font family names.

<div class="exampleserif">
This is an example of a serif font.
</div>
<div class="examplesansserif">
This is an example of a sans-serif font.
</div>
<div class="examplemonospace">
This is an example of a monospace font.
</div>
<div class="examplecursive">
This is an example of a cursive font.
</div>
<div class="examplefantasy">
This is an example of a fantasy font.
</div>