The max-height property is used to set 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.

max-height overrides height, but min-height overrides max-height.

Initial valuenone
Applies toall elements but non-replaced inline elements, table columns, and column groups
PercentagesThe percentage is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the percentage value is treated as none.
Computed valuethe percentage as specified or the absolute length or none
Animatableyes, as a length, percentage or calc(); when both values are lengths, they are interpolated as lengths; when both values are percentages, they are interpolated as percentages; otherwise, both values are converted into a calc() function that is the sum of a length and a percentage (each possibly zero), and these calc() functions have each half interpolated as real numbers.
Canonical orderthe unique non-ambiguous order defined by the formal grammar


/* <length> value */
max-height: 3.5em;

/* <percentage> value */
max-height: 75%;

/* Keyword values */
max-height: none;
max-height: max-content;
max-height: min-content;
max-height: fit-content;
max-height: fill-available;

/* Global values */
max-height: inherit;
max-height: initial;
max-height: unset;


A fixed maximum height. See <length> for possible units.
The <percentage> is calculated with respect to the height of the containing block. If the height of the containing block is not specified explicitly, the percentage value is treated as none.
No limit on the height of the box.
The intrinsic preferred height.
The intrinsic minimum height.
The containing block height minus vertical margin, border and padding. Some browsers implement an ancient name for this keyword, available.
The same as max-content.

Formal syntax

<length> | <percentage> | none | max-content | min-content | fit-content | fill-available


table { max-height: 75%; }

form { max-height: none; }


Specification Status Comment
CSS Intrinsic & Extrinsic Sizing Module Level 3
The definition of 'max-height' in that specification.
Working Draft Adds the max-content, min-content, fit-content, and fill-available keywords.
Both CSS3 Box and CSS3 Writing Modes drafts defined at some point these keywords. These drafts are superseded by this spec.
CSS Transitions
The definition of 'max-height' in that specification.
Working Draft Defines max-height as animatable.
CSS Level 2 (Revision 1)
The definition of 'max-height' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 1.0 (1.7 or earlier) 7.0 7.0 1.0
applies to <table> [1] Not supported (Yes) Not supported (Yes) Not supported
max-content, min-content, and fit-content Not supported [3] 3.0 (1.9)-moz [2] Not supported Not supported 9[3](bug)
fill-available Not supported Not supported bug 527285 Not supported Not supported Not supported
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? ? ? ? ?
applies to <table> [1] ? ? ? ? ?
max-content, min-content, and fit-content ? ? ? ? 9[3](bug)
fill-available ? ? ? ? ?

[1] CSS 2.1 explicitely leaves the behavior of max-height with <table> undefined. Therefore any behavior is CSS2.1-compliant; newer CSS specifications may define this behavior, so Web developers shouldn't rely on a specific one now.

[2] Gecko experimentally implements the definitions given in CSS3 Basic Box. This one defines available and not fill-available. Also the definition of fit-content is simpler than in CSS3 Sizing.

[3] WebKit implements an earlier proposal for setting the height to an intrinsic height: the keywords intrinsic, instead of max-content, and min-intrinsic, instead of min-content. There is no equivalent for fill-available or fit-content.

See also

Document Tags and Contributors

 Last updated by: Sebastianz,