clamp()
noun
say it: “KLAMP” /klæmp/
A CSS function that takes a smallest value, a preferred value and a largest value, and keeps the size between the two limits while it follows the preferred one.
What does clamp() do?
clamp() keeps a value between a minimum and a maximum while letting it grow in between. It is great for text that scales with the screen.
h1 { font-size: clamp(1.75rem, 4vw, 3rem); }
In a sentence
- “The headline uses clamp(), so it grows with the window but stays between 1.75rem and 3rem.”
Level: Freelancer · More CSS terms at this level
Updated