Fluid Sizing with CSS Math Functions

suggest change

min(), max(), and clamp() can express responsive constraints without a series of breakpoints:

.article {
  inline-size: min(calc(100% - 2rem), 70rem);
  margin-inline: auto;
}

.article h1 {
  font-size: clamp(2rem, 1.25rem + 3vw, 4rem);
}

.article__grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(18rem, 100%), 1fr)
  );
  gap: clamp(1rem, 3vw, 2rem);
}

clamp(minimum, preferred, maximum) limits a fluid preferred value. Keep the minimum readable when users zoom, and avoid using viewport units alone for text sizing.

CSS math functions can mix compatible units. Whitespace is required around binary + and - operators when they appear in calculations.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents