Skip to content

Day 3: CSS Custom Properties & Modern Math

Implement modern CSS variables and fluid sizing with calc() and clamp().

:root {
--color-primary: #3b82f6;
--color-text: #1e293b;
--font-base: 'Inter', sans-serif;
}
button {
background-color: var(--color-primary);
color: white;
}
/* clamp(min, preferred, max) */
h1 {
font-size: clamp(1.75rem, 4vw + 1rem, 3.5rem);
}
  1. Extract colors, margins, and typography into a :root variables block.
  2. Replace static font-size on your headings with fluid clamp().