CSS Clamp Generator
Make a font size or spacing that grows smoothly between two screen widths.
How it works
Makes a font size or spacing that grows smoothly between two screen widths using CSS clamp(min, preferred, max).
The formula
preferred = min + (max - min) x (100vw - minWidth) / (maxWidth - minWidth)
Good to know
- Use rem for the limits so the size still respects the visitor's browser font setting.
- Always test zoom to 200 percent.
Common questions
- What does clamp do?
- It picks the middle value but never goes below the minimum or above the maximum.
- Do I still need media queries?
- Often not for type and spacing.
- Which browsers support it?
- All current browsers.