CSS implementation guide · Art and the City · Updated 24 November 2026

From a type scale to usable CSS

The generator provides font-size variables. A working typography system also needs rules for line height, readable text width and responsive headings. This guide connects those pieces without tying your HTML structure to a particular visual size.

Copy the variables into your stylesheet

Choose a base and ratio in the generator, then use Copy CSS. Paste the resulting :root block once into your main stylesheet, before the component rules that use it. The example below uses a 16-pixel base and a 1.25 ratio; the values are rounded.

html { font-size: 100%; }
:root {
  --font-base: 1rem;
  --font-small: 0.8rem;
  --font-h4: 1.563rem;
  --font-h3: 1.953rem;
  --font-h2: 2.441rem;
  --font-h1: 3.052rem;
}
body { font-size: var(--font-base); line-height: 1.6; }
h1 { font-size: clamp(2rem, 1.5rem + 2vw, var(--font-h1)); line-height: 1.12; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, var(--font-h2)); line-height: 1.2; }
h3 { font-size: var(--font-h3); line-height: 1.25; }
.caption { font-size: var(--font-small); line-height: 1.5; }
.prose { max-width: 65ch; margin-inline: auto; padding-inline: 1rem; }
p { margin-block: 0 1em; }

Understand what rem means here

The generator divides each pixel size by 16 to produce rem values. That assumes a 16-pixel root when comparing the numeric pixel preview with the CSS. For example, 25 pixels becomes approximately 1.563rem. If your site sets the root to another size, the rendered result will differ.

Keeping html { font-size: 100%; } respects the browser’s default size. A visitor can choose a larger default, so the final pixel size may intentionally change. Do not force the root to 10 pixels merely to make the arithmetic easier.

Make the headline responsive, not the whole page smaller

In the H1 rule, clamp() chooses a value between 2rem and the generated H1 maximum, with 1.5rem + 2vw as the preferred size. The rem term responds to the root size; the viewport term introduces gradual growth. These are starting values for a layout, not a universal accessibility solution.

If the title still overflows, check long words, container padding and fixed widths. Do not hide the overflow to conceal the text. Read MDN’s clamp reference for the syntax.

Keep structure and appearance separate

Use H1, H2 and H3 for the document outline. A large promotional sentence can be a paragraph with a display class. A visually small section heading can still be an H2. The generator’s H4 variable is available, but the example does not require an H4 element just to use that size.

Check the result before reusing it everywhere

  1. Load real content, including a long heading, a list and a form label.
  2. Check a narrow viewport and a large desktop width.
  3. Zoom to 200% and confirm that text and controls remain usable.
  4. Increase the browser’s default font size and check again.
  5. Inspect line wrapping and avoid fixed-height text containers.

W3C’s guidance on resizing text and reflow explains these checks. Choosing rem units alone does not establish accessibility.

When the copied CSS seems to do nothing

Check that the variables are inside :root, the stylesheet is loaded, and the component actually uses var(--font-h1). Inspect the browser’s computed styles for a later rule overriding your heading. In WordPress or a page builder, a widget’s typography setting may take precedence. Clear the relevant cache only after confirming that the saved stylesheet contains your change.