The name sign over Grandma Marni’s stall: type a clamp() font-size, drag the stall’s width, and the browser measures clamp’s three terms at widths from 200 to…
Why it matters
Fluid sizing means fewer breakpoints and no size "jumps" at media query edges. clamp() is everywhere: font, padding, gap, column widths. Knowing how the browser picks one of its three values lets you write sizes that fit a phone and a wide screen at once.
The key idea
clamp(MIN, VAL, MAX) = max(MIN, min(VAL, MAX))
Common mistakes
The min value is bigger than maxclamp(MIN, VAL, MAX) = max(MIN, min(VAL, MAX)), so when MIN > MAX the result is always MIN. Example: clamp(60px, 30px, 20px) = 60px. Order the arguments: small, flowing, big.
Using vw when you want it to follow the componentvw = 1% of the viewport width. For a component used in both a sidebar and the main column, put container-type: inline-size on its wrapper and use cqi.
clamp() with no relative unit in the middleclamp(20px, 30px, 56px) is always 30px, not fluid. VAL must be relative (cqi, vw, %), ideally rem + cqi so it still follows the user’s text setting.
Try it in this playground
Narrow the stall until MIN wins The name stops shrinking. On the graph the dot sits on the MIN line; on the tape the stall’s edge is in MIN’s colour.
Widen it until MAX wins With 7cqi, the 56px MAX is reached at 800px (56 ÷ 0.07). Any wider and the name stays put.
Change cqi to vw The line goes flat: vw follows the browser window, the stall width has no effect. Resize the window and only then does it move.
Write a MIN bigger than MAX For example clamp(60px, 7cqi, 20px). It is 60px at every width: MIN wins, because it is the outermost.