A clamp combines a minimum, a fluid middle value and a maximum. The ceiling keeps generous desktop spacing from growing indefinitely.
Worked example
<style>
.demo {
padding: min(6vw, 2rem);
}
</style>
<div class="demo">Apply fluid spacing with a ceiling</div>Implementation notes
Use a fluid middle term with compatible units. A clamp whose preferred value never leaves its limits behaves like a fixed spacing token.
Try it yourself
Resize past both bounds and inspect the computed padding.
Open the CSS example →Editorial date July 12, 2026 · Published December 6, 2026