Style maxHeight Property
The Style object
Definition and Usage
The maxHeight property sets or returns the maximum height of an element.
The maxHeight property only takes effect on block-level elements or absolutely/fixed-positioned elements.
**Note:** The height of an element can never be greater than the value specified by the maxHeight property.
Syntax
Sets the maxHeight property:
Object.style.maxHeight="none|
length|%
|inherit"
Returns the maxHeight property:
Object.style.maxHeight
| Value | Description |
|---|---|
| none | Default. The height of the element is not limited. |
| length | Defines the maximum height using units such as px, cm, etc. |
| % | Defines the maximum height as a percentage of the parent element. |
| inherit | The maxHeight property value is inherited from the parent element. |
Browser support





All major browsers support the maxHeight property.
**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".
Example
Example
Sets the maximum height of an element:
This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.
Try it »
The Style object