CSS math functions (calc(), min(), max(), clamp()) make responsive formulas concise and maintainable.
Practical examples
width: calc(100% - 2rem)font-size: clamp(1rem, 1vw + 0.8rem, 1.5rem)height: min(70vh, 40rem)
Important interview questions and answers
- Q: Why is
clamp()popular for typography?
A: Sets safe min/preferred/max bounds in one expression. - Q: Common calc mistake?
A: Missing spaces around operators in some contexts or mixing incompatible units incorrectly. - Q: Benefits over many media-query steps?
A: Smoother scaling with less repetitive breakpoint code.
Pitfall: Check cascade order—author stylesheet loses to inline styles and !important surprises.