Table of contents
- 2. Browser compatibility
- 2.1. See also
« CSS « CSS Reference
Summary
The max-height CSS property is used to set the maximum height of a given element. It prevents the used value of the height
property from becoming larger than the value specified for max-height.
- Initial value
:
none - Applies to: block level and replaced elements
- Inherited : no
- Percentages: yes, see below
- Media:
visual - Computed value
: the percentage as specified or the absolute length or
none
Syntax
max-height: <length> | <percentage> | none | inherit
Values
- <length>
- A fixed maximum height. See
<length>for possible units. - <percentage>
- 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 asnone. - none
- No limit on the height of the box.
Examples
View Live Examples (not available, please check later)
table { max-height: 75%; }
form { max-height: none; }
Notes
max-height
overrides height, but min-height
overrides max-height
.
Specifications
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 1.0 | 1.0 (1.7 or earlier) | 7.0 | 7.0 | 1.0 |
| Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | 1.0 | 1.0 (1) | 6.0 | 6.0 | 1.0 |
See also
box model, max-width
, box-sizing
, height
, min-height
Mozilla Developer Network