Skip to main content

What does clamp() do?

clamp() sets a value that cannot be smaller than the minimum or larger than the maximum. The function takes three parameters: min, preferred, max. The browser picks the "preferred" value but keeps it within the given bounds.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.