NewAI video is here. What should creatives actually use it for?
Design

A type scale that works everywhere

How to build a fluid type scale with CSS clamp(): choosing a ratio, setting min and max sizes, line height and testing with real content.

Creative Pouch · · 3 min read · Updated

Assorted wooden letterpress type blocks
Photo: Bruno Martins on Unsplash

A good type scale gives a layout rhythm. A fluid one keeps that rhythm at every screen size, from a 360px phone to a 2560px monitor, without a pile of breakpoints. Here’s a practical way to build one that holds up in real products.

What a type scale is

A type scale is a fixed set of font sizes, each one a step up from the last by the same ratio. Instead of picking 17px here and 23px there, you choose a base size and a ratio, and every heading size follows from them. The result is hierarchy that feels intentional: readers can tell an H2 from an H3 at a glance, and designers stop debating individual pixel values.

Pick a ratio

The ratio sets the character of the whole system:

  • 1.125 – 1.2 (major second, minor third): small steps that suit dense interfaces, dashboards and apps where space is tight.
  • 1.25 – 1.333 (major third, perfect fourth): the most versatile range, good for marketing sites and blogs.
  • 1.5 – 1.618 (perfect fifth, golden ratio): big, dramatic jumps for editorial layouts and landing pages with few headings.

A useful trick is to use two ratios: a smaller one on mobile, where big jumps waste space, and a larger one on desktop, where headlines need presence. Fluid sizing lets you move smoothly between them.

Make it fluid with clamp()

CSS clamp(min, preferred, max) lets a size grow with the viewport and stay within limits:

h1 { font-size: clamp(2.2rem, 1.4rem + 3.2vw, 3.6rem); }

Mixing rem and vw in the middle value matters. A pure vw value ignores the user’s browser font settings, which is an accessibility problem; adding a rem component keeps text zoomable.

A complete scale might look like this:

:root {
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);   /* body */
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);     /* h4 */
  --step-2: clamp(1.44rem, 1.25rem + 0.9vw, 2rem);     /* h3 */
  --step-3: clamp(1.73rem, 1.4rem + 1.6vw, 2.65rem);   /* h2 */
  --step-4: clamp(2.07rem, 1.5rem + 2.8vw, 3.55rem);   /* h1 */
}

Generators such as Utopia calculate these values for you from a minimum and maximum viewport, base size and two ratios.

Don’t forget line height and spacing

Font size is only half of the scale. Large headings need tighter line height (around 1.05–1.15), while body text needs more room (1.5–1.7). Letter spacing works the same way: big display text often looks better slightly tightened, small uppercase labels slightly opened up.

Spacing between elements should come from the same system. If your vertical rhythm uses multiples of the body line height, headings, paragraphs and lists line up naturally.

Limit the number of sizes

Most interfaces need five to seven sizes in total. Every extra size makes the hierarchy weaker, not stronger. If you find yourself adding a “size between H3 and H4”, the problem is usually the content structure, not the scale.

Test with real content

Lorem ipsum hides problems. Test the scale with the content you’ll actually publish:

  • the longest real headline, at the narrowest screen;
  • a one-word heading, at the widest;
  • long words in German or Finnish, URLs and product names;
  • headings next to images, cards and buttons, not on an empty page.

Check it at 200% browser zoom too: a fluid scale that only works at 100% isn’t finished.

Summary

Pick a ratio that fits the product, make sizes fluid with clamp() and a rem + vw mix, keep the number of steps small, tune line height per step and test with real copy. Do that once, put the values in design tokens, and every new page gets good typography for free.

  • #typography
  • #css
  • #ui
  • #type scale
  • #responsive design

More in Design