css.properties

max-height

The max-height property sets the maximum height of an element.

Formal Syntax

none | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()> | stretch | fit-content | contain

See specification

JavaScript Access

// Access via element.style
element.style.maxHeight = 'none';

Logical Property Group

This property belongs to the max-size logical property group, which includes:

Browser Support

standard | MDN · Spec

FeatureChromeFirefoxSafariEdge
max-height111.312
anchor-size12514726125
fit-content46941179
fit-content_function91
max-content46661179
min-content46661179
none1811.312
stretch1389138

Behind a Flag

Some browsers require enabling a flag or preference:

  • max-height: fit-content_function — firefox: #layout.css.fit-content-function.enabled (since 91)

Related Properties