A 'font-family' is a group of fonts that exhibit similar characteristics.
The 'font-family' property indicates a prioritized list of specific/generic
font family names to use to display text content in the current container.
At least one specific or general font family must be given. If the
specified font does not exist, or the necessary glyph is not available
in the specified font, the next font is tried. This process continues
through the prioritized list until no more are available. If no match
is made, the browser default font family should be used.
Allowed Values
inherit
[CSS2] [N6|O7]
Type: Explicit
Description:
Explicitly sets the value of this property to that of the parent.
serif | sans-serif |
cursive | fantasy |
monospace
[CSS1|CSS2]
[IE3|N4B2|O3.5]
Type: Calculated
Description:
These values refer to generic font families that have certain visual
characteristics. Browsers will attempt to map an existing font for the
selection using this generic family specification. It is recommended to
offer a generic font family value as a last alternative after specifying
specific font family names.
[specific font-family]
[CSS1|CSS2]
[IE3B1|N4B2|O3.5]
Type: Explicit
Description:
This value will be a string identifying a specific font. Font names
containing white space should be quoted (else the value is normalized.)
- There is little agreement about what constitutes a font from
the "cursive" and "fantasy" generic font-families.
- The "inherit" value is listed in the standards for this property, although
the property is itself inherited. This means it is impossible to check
to see if this value is actually supported in any browser. Mozilla began
generally supporting "inherit" where appropriate in version 6.x, and
Opera beginning mostly in 7.x. IE does not yet support "inherit" anywhere
yet. So, for all inherited properties, support information for the
"inherit" value will be listed as beginning in these respective versions.
Internet Explorer
3.0:
- Use of font family names containing spaces is not supported
for inline styles. External and embedded styles are OK.
- Using a list of fonts for the Font-family value can cause
subsequent declarations in a style rule to fail. The easy fix
for this behavior is to list the Font-family property last in
any style rule.
- Font-family names containing spaces should be contained in
double or single quotes. The declaration must also be explicitly
terminated by a semi-colon (which should be optional if no other
declarations follow it in the rule) for subsequent rules to be
parsed correctly.
Netscape
4.x:
- The "Cursive" generic font-family appears to be treated as
"Serif" and "Fantasy" appears to be treated as "Sans-Serif."
- If you use the 'font' property, you MUST specify
BOTH the 'font-size' and 'font-family' sub-components
of this property or else the style declaration will be ignored -
even if you have also set the 'font-size' and 'font-family'
properties individually for the same selector! Specifying both
of these sub-properties for 'font' is actually required under
the specifications, but Netscape is the only browser that
requires it. IE and Opera are fine if you only use one of these.
Opera
3.5:
- Listing an unknown font, followed by a known font does not use the
known font-family. It uses instead the default font-family.