clamp() lets font sizes scale smoothly with the viewport while staying within sensible minimum and maximum bounds — replacing a whole pile of media query breakpoints with one line.
h1 {
/* clamp(minimum, preferred, maximum) */
font-size: clamp(1.75rem, 4vw + 1rem, 3.5rem);
}
.container {
padding: clamp(1rem, 5vw, 3rem);
}
Without clamp(), fluid typography needed several @media breakpoints, each hardcoding a specific font size for a specific range — brittle, and it never actually scaled smoothly between those fixed points. clamp() scales continuously, and the min/max bounds prevent text from becoming unreadably small or absurdly large at extreme viewport sizes.