1<body>2 <h1>Hello!</h1>3 <p>Good type is<br>4 easy to read.</p>5</body>index.htmlHello!Hello!Good type isGood type iseasy to read.easy to read.<body>element<h1>element<p>element1body {2 font-family: Inter,3 Arial, sans-serif;4 font-size: 18px;5 line-height: 1.5;6}7h1 {8 text-align: center;9}ArialGeorgiaTimes New Roman<body><h1><p>InterArialArialArial18px18px18px1.51.51.5center
Left: the two files, index.html (content) and style.css (two rules about text)Right: the browser, the body element with h1 and p on it, and the installed fontsTokens: font names, values passed from body to its children, and center for h1Left: the HTML (a body holding a heading and a two-line paragraph) and the stylesheet (a body rule and an h1 rule). Right: the browser window, the body element with its children h1 and p, and the fonts this computer has. The browser picks the first font in the stack it has (Arial), body passes font, size and line height down to h1 and p, and only the heading is centred. A real browser applies every declaration at once while it works out each element's style. The figure applies them one at a time, and shows the font switch only when it reaches the elements, so you can see what each step does.

Fonts

  1. Typography is how text looks. With no CSS, the browser uses its defaults: a serif font, often Times New Roman, at 16px. Its own style makes the heading bold and twice as big, 32px.

Inheritance

Size, spacing, alignment

What happens

;; step 1/8 · defaults
index.html: body holds h1 and p
no CSS yet: the browser's own defaults
  p    Times New Roman (serif), 16px
  h1   Times New Roman (serif), 32px, bold
       line height "normal", about 1.15 × size
  h1   font-size: 2em = 2 × 16px = 32px
serif fonts have small feet on the letters

A real browser applies every declaration at once while it works out each element's style. The figure applies them one at a time, and shows the font switch only when it reaches the elements, so you can see what each step does. The figure's computer has Arial, Georgia and Times New Roman and no Inter. Real computers differ, which is why a stack ends with a generic family. A page can also download a font with @font-face, a later topic.