CSS max-height property
Example
Set the maximum height of a paragraph:
p
{
max-height:
50
px
;
}
Try it »
Property definition and usage
The max-height property sets the maximum height of an element.
Note: The max-height property does not include padding, borders, or margins!
| Default value: | none |
|---|---|
| Inherited: | no |
| Version: | CSS2 |
| JavaScript syntax: | object.style.maxHeight="10px" |
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| max-height | 1.0 | 7.0 | 1.0 | 2.0.2 | 7.0 |
Attribute values
| Value | Description |
|---|---|
| none | Default. Defines no limit on the maximum height allowed for an element. |
| length | Defines the maximum height value of an element. |
| % | Defines a percentage maximum height based on the containing block-level object. |
| inherit | Specifies that the value of the max-height property should be inherited from the parent element. |
Related Articles
CSS Tutorial: CSS Dimension
CSS Reference Manual: min-height property