11. Font Properties

11. Font Properties

font-family: familyname [, familyname]...
Real families must be quoted; generic families must not. Generic families are serif, sans-serif, cursive, fantasy, monospace. You should always use a generic family as the last alternative. Example:
h1 { font-family: "impact", "helvetica", sans-serif; }
font-size: size
Set font size. Size can be
  • an absolute value: xx-small, x-small, small, medium, large, x-large, xx-large,
  • a relative value: smaller, larger,
  • length (in em, ex, px, etc.), or
  • percentage.
font-style: style
Sets font style. Style can be normal, italic, or oblique.
font-variant: variant
Sets font variant. Variant can be normal or small-caps.
font-weight: weight
Sets font weight. Weight can be normal, bold, bolder, or lighter.
font: style? variant? weight? size family
Shorthand for multiple font properties
E.g.: font: italic bold 12px serif
Ken Keys, CAIDA, 2006-12-01