Manuel Matuzović has published a short CSS demo, itself derived from a demo by Temani Afif, that relies on max() to keep an element's inline margins from ever going negative.

.wrapper {
  margin-inline: max(0px, ((100% - 64rem) / 2)); 
}

The one-liner expands into this longer equivalent:

.wrapper {
  max-width: 64rem;
  margin: 0 auto;
  width: 100%;
}

How the value set resolves

The shorthand rests on a handful of properties of the CSS math functions and logical properties:

  • max() takes a comma-separated list of numeric values and evaluates to the largest — MDN's phrasing is the "most positive" — of them.
  • 0px sits first in the list, so the result can never be smaller than zero pixels.
  • (100% - 64rem) is a calculation rather than a literal value: it subtracts the element's max-width (64rem) from its full available width (100%), leaving the space the element does not occupy. No calc() wrapper is needed.
  • Dividing that remainder by two — ((100% - 64rem) / 2) — splits it evenly, because it is being distributed across the element's two inline boundaries.
  • The outer max() compares 0px against ((100% - 64rem) / 2) and uses whichever is larger. Normally that is the division result; if 64rem ever exceeds the element's computed 100% width, the value is floored at zero and never goes negative.
  • margin-inline receives the winning value, applying it to the inline sides of the element. It is the logical shorthand for assigning the same value to margin-left and margin-right.

Relation to the "Inside Problem"

The technique follows the same reasoning Chris applied earlier to a container that needs a full-bleed background while its content stays constrained by padding — the "Inside Problem" — using max() to enforce an inner element's maximum width.

Matuzović is documenting max(), calc() and margin-inline, along with other modern CSS features, as part of a 100-day writing series.