Tóm Tắt
CSS
max-height
Property
Example
Set the maximum height of a <p> element to 50 pixels:
p.ex1
{
max-height: 50px;
}
Try it Yourself »
Definition and Usage
The max-height
property defines the maximum height of an element.
If the content is larger than the maximum height, it will overflow. How the
container will handle the overflowing content is defined by the
overflow property.
If the content is smaller than the maximum height, the
property
max-height
has no effect.
Note: This prevents the value of the
height property from becoming larger than
max-height
. The value of the
property overrides
max-height
the height property.
Default value:
none
Inherited:
no
Animatable:
yes, see individual properties. Read about animatable
Try it
Version:
CSS2
JavaScript syntax:
object.style.maxHeight=”100px”
Try it
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property
max-height
1.0
7.0
1.0
2.0.2
7.0
CSS Syntax
max-height: none|length|initial|inherit;
Property Values
Related Pages
CSS tutorial: CSS Height and Width
CSS reference: min-height property
HTML DOM reference:
maxHeight property