calc(), min(), max()

Do maths in CSS, mixing units, and pick the smaller or larger of two values.

Also called: calc, min(), max()

Domain
Languages
Source
General
Language
CSS

Example

width: min(1100px, 100% - 32px) keeps the content centred with a margin on phones.

In code

.sidebar { width: calc(100% - 280px); }
.wrap { width: min(1100px, 100% - 32px); margin-inline: auto; }

Learn more

Related terms

Added 2026-11-30 · Last reviewed 2026-11-30