CSS3 & Modern Layouts (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is Responsive Typography using `clamp()`?
junior LevelCode ExampleData Structures
In Simple Words:
clamp(MIN, PREFERRED, MAX) clamps a value between a lower bound and an upper bound:
css
/* Fluid Typography: Scales smoothly with viewport width! */
h1 {
font-size: clamp(1.75rem, 1rem + 2.5vw, 3.5rem);
}
- On a small mobile phone ($320\text{px}$), the font size will never drop below
1.75rem. - On a massive 4K desktop display ($2560\text{px}$), the font size will never exceed
3.5rem. - In between, it scales smoothly based on viewport width (
2.5vw) without jagged media query breakpoints!