liveBook · Manning

Generic font

As explained in Web Design Playground, Second Edition

A generic font family is a CSS font-family category that represents a broad class of typefaces and serves as a fallback when a specific font is unavailable.

A generic font is a CSS font-family category representing a broad typeface class. It gives the browser a dependable fallback when a specific font is unavailable. section 4.2

CSS provides five generic font families:

  • serif — traditional letterforms with small finishing strokes section 4.1
  • sans-serif — clean letterforms without finishing strokes section 4.1
  • monospace — gives every character the same amount of space section 4.1
  • cursive — resembles handwritten pen or brush writing section 4.1
  • fantasy — uses fanciful designs for special effects section 4.2 section 4.1

A simple fallback

Apply a generic family directly with the font-family property: h3 { font-family: sans-serif; } p { font-family: serif; } The browser then renders headings and paragraphs using those broad categories. section 4.2

h3 {                                #1
    font-family: sans-serif;        #1
}                                   #1
p {                                 #2
    font-family: serif;             #2
}                                   #2

Inspect the small CSS example applying sans-serif to an h3 and serif to paragraphs. section 4.2

How Web Design Playground, Second Edition covers it

How deep it goes
Defines five families and demonstrates font-family usage, but stops short of detailed typography internals.
Examples
Uses serif and sans-serif rules for headings and paragraphs, then places generic families after system fonts in fallback stacks.
What it assumes
Builds from basic CSS font-family usage while introducing typeface categories and the distinction between generic and system fonts.
What you can do after
Apply it via CSS by assigning serif, sans-serif, monospace, cursive, or fantasy to font-family.
How it connects
Connects font-family with typeface categories, system fonts, and font stacks.

Also explained in

Compare how 2 books explain generic font →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground, Second Edition. The section links point to the parts of the book it draws on.