Name
font-family
Synopsis
You can specify any font (or list of fonts, separated by commas) in
the font-family property. Bear in mind, however,
that the font needs to be present on the user’s machine in
order to display, so it is safest to stick with common fonts.
You may (and it is advisable) include a generic font family as the last option in your list so that if the specific fonts are not found, a font that matches the general style of your choices will be substituted. The five possible generic font family values are:
Serif (e.g., Times)
Sans-serif (e.g., Helvetica or Arial)
Monospaced (e.g., Courier or New Courier)
Cursive (e.g., Zapf-Chancery)
Fantasy (e.g., Western, Impact, or some display-oriented font)
Note that in the example, the first font is enclosed in quotes. Font names that contain character spaces must be enclosed in quotation marks (single or double). Generic family names must never be enclosed in quotation marks.
Values:
family name, generic family nameExample:
P {font-family: "Trebuchet MS", Verdana, sans-serif}Applies to:
All elements
Inherited:
Yes
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access