1<link rel="stylesheet"2 href="style.css">3<h1>Hello!</h1>4<p>My first page.</p>index.htmlHello!My first page.1h1 {2 color: tomato;3 font-size: 48px;4 letter-spacing: 4px;5}<h1>element<p>element<h1><p>h1tomato48px4px
Left: the two files, index.html (content) and style.css (style)Right: the browser window showing the page, and the elements it madeTokens: tags, the stylesheet, the selector and each declaration on their wayLeft: the HTML file (the content) and the CSS file (the style, one rule). Right: the browser window and the two elements it made from the HTML. Once the HTML links style.css, the browser matches the selector h1 to the heading element only, then applies each declaration: the heading turns tomato, grows to 48px and spreads its letters 4px apart. Change only the CSS values and the same HTML takes a new look. A real browser applies all of a rule's declarations at once, while it works out the style of every element. The figure applies them one at a time so you can see what each one does.

Content and style

  1. HTML says what is on a page. This file has a heading, h1, and a paragraph, p. The browser makes an element for each one and, with no CSS yet, draws them in its plain default style.

The browser at work

Applying the rule

What happens

;; step 1/9 · html-content
index.html   the content
  <h1>  a heading     "Hello!"
  <p>   a paragraph   "My first page."
no CSS yet: the browser's own defaults
  h1    black, 32px, letter-spacing 0px, bold
  p     black, 16px, letter-spacing 0px

A real browser applies all of a rule's declarations at once, while it works out the style of every element. The figure applies them one at a time so you can see what each one does. Without any CSS the browser still has a built-in stylesheet. It makes h1 bold, twice the normal size and gives it space above and below; the page drawing follows those defaults approximately.