On this page
  1. Math & Sizing Functions
  2. Contents
  3. calc(), min(), max(), and clamp()
  4. Grid Sizing Functions (minmax(), repeat())

Math & Sizing Functions

Prev: functions | Up: functions | Next: Color & Value Functions
Rel: Box Model & Sizing, Responsive Design & Theming
Ref: MDN Web Docs — CSS Math Functions
Tags: #public #web #css #functions


Contents


calc(), min(), max(), and clamp()

.container {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}
h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.5vw, 3rem);
}

Grid Sizing Functions (minmax(), repeat())

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
}

Linked from

Related notes