How to use the clamp generator
- Enter the smallest and largest sizes.
- Enter the viewport widths where scaling starts and ends.
- Copy the declaration.
How the preferred value works
It is a straight line through your two points, written as a rem offset plus a vw slope. Keeping a rem part means the size still responds to user font settings.
Frequently asked questions
Can I use it for spacing?
Yes. Replace font-size with padding, gap or margin.
Does fluid type affect accessibility?
It can. Keep the largest size within about 2.5 times the smallest and test browser zoom.
Is clamp() widely supported?
Yes, in all current major browsers.