max-height

The max-height CSS property sets the maximum height of an element. It prevents the used value of the height property from becoming larger than the value specified for max-height.

Example

Initial value none
Applies to all elements but non-replaced inline elements, table columns, and column groups

Syntax

  
max-height: 5em;
  

Values

Defines the max-height as an absolute value.
Defines the max-height as a percentage of the containing block's height.
No limit on the size of the box.
The intrinsic preferred max-height.
The intrinsic minimum max-height.
Uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)).

Browser support

max-height18121771.3
fit-content467934411
max-content4679664411
min-content4679664411
stretch287915

We use cookies to improve your experience. Learn more in our Privacy policy.

×