liveBook · Manning

Google Fonts

As explained in CSS in Depth, Second Edition

Google Fonts is an online service that provides hosted web fonts and CSS code for including them in web pages.

Google Fonts supplies hosted web fonts and generated CSS for giving a page a distinctive typographic voice without handling font hosting or licensing yourself. A practical pairing uses Roboto for body text and Sansita for headings. section 12.2 section 12.3

A typical setup follows this sequence:

  • Search the directory for a typeface such as Sansita or Roboto. section 12.3
  • Select the required weights and styles instead of automatically including every available variant. section 12.3
  • Copy the generated embed code into the page, then reference the families by name in CSS. section 12.3

Apply distinct fonts by role

Set `font-family: Roboto, sans-serif` on the body for readable general content, then use `font-family: Sansita, serif` on headings and selected interface elements. Changing only the typeface can shift a page from formal to informal or playful, so font pairing becomes a design decision rather than a purely technical substitution. section 12.2

How CSS in Depth, Second Edition covers it

How deep it goes
Demonstrates directory selection, weight refinement, embed-code retrieval, and CSS application.
Examples
Uses Sansita for headings, Roboto for body text, generated link tags, and contrasting typeface pairs.
What it assumes
Assumes a roughly built web page and familiarity with regular and bold font weights while demonstrating the selection process.
What you can do after
Apply it via Google Fonts by selecting families, copying embed code, and assigning them through CSS.
How it connects
Connects web fonts with CSS, typography, typefaces, font weights, font styles, and visual tone.

Also explained in

Compare how 4 books explain Google Fonts →

Related concepts

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