Skip to content
Musterli
Support
CSS effects and layouts

Fluid Spacing Scale Generator

Spacing that grows with the screen width: t-shirt sizes from 3xs to 3xl as CSS clamp(), with CSS variables, utility classes and a Tailwind theme.

Open the generator

Runs right in your browser. Your graphics are made on your device.

Example motif made with the Fluid Spacing Scale Generator

Start from a preset

Pick a preset and it opens right in the editor, ready to adjust.

What is it?

A fluid spacing scale is a set of space values (padding, gaps, margins) that grow smoothly with the screen width. Each size is a fixed multiple of a base space and is written as CSS clamp(), so small screens get tighter and large screens get more generous spacing without breakpoints.

What you can use it for

  • Consistent layouts

    One scale for all gaps keeps a site calm and consistent, from buttons to whole sections.

  • Fewer breakpoints

    Spacing that grows with the viewport replaces many media queries for padding and margins.

  • Design tokens

    The variables fit straight into a design system or a Tailwind v4 theme.

How it works

Set the smallest and largest screen width and the base space at both. Choose how many sizes you need below and above the base, and add pairs that jump from one size to the next across the range. Check the sizes at any width in the preview, then copy CSS variables, utility classes or a Tailwind theme.

Try the Fluid Spacing Scale Generator now

Tips

  • Pair the spacing scale with the fluid type scale and use the same viewport range for both.
  • Pairs such as s-l are great for section padding that should change a lot between phone and desktop.
  • Keep the base space close to your body text size, often 16 to 20 px.

FAQ

How are the sizes calculated?
Every size is a fixed multiple of the base: 3xs is a quarter, s is the base, m is 1.5 times, l twice, up to 3xl at six times. The base itself grows linearly between the two screen widths.
What are pairs?
A pair goes from one size on small screens to a larger size on large screens, for example from s to l. It grows faster than a single size.
Does it work with Tailwind?
Yes. The Tailwind theme export defines --spacing-* variables for Tailwind v4, so classes like p-s, gap-m or mt-xl use the fluid values.
Is clamp() safe for zoom?
Yes. The values combine rem and vw, so they still grow when people zoom the page.