Skip to content
CSS·Advanced·Coding·1 min read

Why use clamp for fluid sizing carefully?

Short interview answer

clamp combines a minimum, preferred fluid expression, and maximum. It reduces abrupt jumps, but viewport-only text scaling can weaken zoom behavior if constructed poorly. Keep accessible bounds and test text zoom and narrow screens.

Example

CSS
h1 { font-size: clamp(1.75rem, 1rem + 3vw, 3rem); }/* never smaller than 1.75rem, never larger than 3rem */

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Responsive design and container queries

Related questions