CSS Property - Font Family
Value: [[<family-name> | <generic-family>],]* [<family-name> | <generic-family>]
Initial: UA specific
Applies to: all elements
Inherited: yes
Percentage values: N/A
The CSS property "font-family" is a prioritized list of font family names and/or generic family names. Unlike most other CSS1 properties, values are separated by a comma to indicate that they are alternatives.
Example:
body {
font-family: gill, helvetica, sans-serif;
}
There are two types of list values:
<family-name> - The name of a font family of choice. In the last example, "gill" and "helvetica" are font families.
<generic-family> - In the example above, the last value is a generic family name.
The following generic families are defined:
- "serif" (e.g. Times)
- "sans-serif" (e.g. Helvetica)
- "cursive" (e.g. Zapf-Chancery)
- "fantasy" (e.g. Western)
- "monospace" (e.g. Courier)
Style sheet designers are encouraged to offer a generic font family as a last alternative.
Font names containing whitespace should be quoted:
Example:
body {
font-family: "new century schoolbook", serif;
}
If quoting is omitted, any whitespace characters before and after the font name are ignored and any sequence of whitespace characters inside the font name is converted to a single space.