Interview Question

What is clamp() function?

`clamp()` creates a value with explicit lower and upper limits.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

The `clamp()` function limits a preferred value between a minimum and maximum. • It takes minimum, preferred, and maximum arguments. • The preferred value can be fluid, such as a viewport-based length. • The result never goes below the minimum or above the maximum.

💡 Simple Example

h1 { font-size: clamp(2rem, 5vw, 4rem); }

⚡ Quick Revision

`clamp()` creates a value with explicit lower and upper limits.