Start a project

Tool 06 of 29 · Typography

Fluid Type Scale

Make headings and spacing grow smoothly from a phone to a big screen with CSS clamp(), so you can stop writing breakpoints just to change font sizes.

Fluid Type Scale

Settings

1rem in your CSS, usually 16

Preview

Space scale

Your scale

StepSmallest screenLargest screen
CSS custom properties

Use them like h1 { font-size: var(--step-4); } and .stack > * + * { margin-top: var(--space-m); }.

01

What it does

CSS clamp() type and spacing scales that grow smoothly from phone to desktop, with a live preview at any width.

  • Type scale from two sizes and two ratios
  • Space scale with one-up pairs
  • Live preview at any screen width
  • WCAG 1.4.4 zoom warning

02

Private by design

Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

03

What you get

CSS custom properties, with a Copy and a Download button on every result.

  • CSS clamp()
  • Custom properties
  • Modular scale

Why it matters

Most sites set font sizes at two or three breakpoints, so headings jump in size as you resize the window and look too big or too small in between. A fluid scale sets a size for the smallest and largest screens and lets CSS work out everything in between with clamp(), which every current browser supports.

Using a modular scale (each step a fixed ratio bigger than the last) keeps headings in proportion, and a matching space scale means padding and gaps grow with the text. The result is a layout that feels designed at every width, with less CSS than a stack of media queries.

How to use it

  1. Set your body text size for the smallest and largest screens, and the screen widths they apply at.
  2. Pick a scale ratio for each end. A smaller ratio on phones stops headings getting too big.
  3. Drag the screen width slider to see every step at that width.
  4. Copy or download the CSS, then use var(--step-0) for body text and higher steps for headings.

FAQ

Why use rem in the clamp()?

The rem parts respect the reader's browser font-size setting, so text still gets bigger when someone has chosen larger text. The vw part is what makes it fluid.

What is the 2.5× warning?

WCAG 1.4.4 asks that text can be zoomed to 200%. If a size grows more than 2.5 times across the range, zooming can stop making it bigger, so the tool warns you.

Does it work with Tailwind?

Yes. Paste the variables into your CSS and reference them in your theme, for example fontSize: { h1: 'var(--step-4)' }.

Which ratios work best?

1.2 on phones and 1.25 to 1.333 on desktop suit most sites. Bigger ratios make dramatic headlines but need more room.

Work with me

Want a site that gets these right?

I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

All developer tools · Back to leej.uk