Fluid typography
Use clamp for headings and body text that scale smoothly between phones and desktops without several media queries.
CSS clamp() creates a responsive value with a minimum, preferred fluid value, and maximum. This calculator turns your size and viewport limits into copy-ready CSS for fluid typography, spacing, padding, and layout gaps.
Generated CSS
font-size: clamp(1rem, 3.3333vw + 0.3333rem, 3rem);Preferred value: 3.3333vw + 0.3333rem
The value scales from 1rem at 320px to 3rem at 1280px.
Clamp value
clamp(1rem, 3.3333vw + 0.3333rem, 3rem)CSS declaration
font-size: clamp(1rem, 3.3333vw + 0.3333rem, 3rem);Minimum
1rem
Preferred
3.3333vw + 0.3333rem
Maximum
3rem
Use clamp for headings and body text that scale smoothly between phones and desktops without several media queries.
Apply the same formula to padding, margin, section gaps, and card spacing so layouts breathe at every viewport size.
The generated output keeps the minimum, preferred value, and maximum visible so your team can review the responsive range.
Short answers for developers learning when and how to use fluid CSS values.
CSS clamp() sets a value that can grow and shrink between a minimum and maximum. It is commonly used for responsive font sizes, spacing, padding, and gaps.
A fluid typography clamp value uses a fixed minimum size, a fixed maximum size, and a preferred value based on viewport width. The preferred value is calculated from the slope between your minimum and maximum viewport widths.
Use rem for text when you want to respect browser font-size preferences. Pixels are fine for spacing systems, but rem can make spacing scale better with user settings.
Clamp can replace many simple responsive size media queries. You may still need media queries for layout changes, visibility rules, or complex component behavior.
Yes. CSS clamp is supported by modern Chrome, Safari, Firefox, and Edge, making it safe for most current responsive web projects.
Pair fluid sizing with layout, color, and animation tools from Zap Code.
Zap Code helps kids describe apps, games, and tools in plain English, then learn from real HTML, CSS, and JavaScript.