Back to CSS1 Reference | CSS1 Properties
Prev font | Next font-size

<family-name>, <generic-family> (see below)
UA specific

The value 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:

      BODY { font-family: gill, helvetica, sans-serif }

There are two types of list values:

The name of a font family of choice. In the last example, "gill" and "helvetica" are font families.
In the example above, the last value is a generic family name. The following generic families are defined:
Style sheet designers are encouraged to offer a generic font family as a last alternative.

Font names containing whitespace should be quoted:

      BODY { font-family: "new century schoolbook", serif }
      <BODY STYLE="font-family: 'My own font', fantasy">

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.

The only three generic families that are safe for generic cross-compatible development are serif, sans-serif, and monospace.

The cursive family is by default mapped to MS Comic Sans in MSIE. Sadly, Comic Sans is nowhere near cursive. Not to mention that in CSS, 'cursive' means 'any font that appears hand-written'.
The fantasy family is simply any font that doesn't fit into any other categories. This generally means wild variation between platforms.
Unfortunately, Netscape 4 ignores the cursive and fantasy families altogether. Go ahead and set all of the specific fonts you want, but leave the generic fonts to serif, sans-serif, and monospace.

Wilson, Brian. "Font-Family" Cascading Style Sheets Properties 1996-2002. August 17, 2002.

Log in or register to write something here or to contact authors.