Search within TutorialsPark

CSS max-height Property


To set the maximumn height of an element


Definition and Notes.

1. The CSS max-height property is used to set the maximum height.It means that, the element's box may be shorter than this value, but can't be any taller.

2. If contents are taller than the max-height value, they overflow the containing box.


Syntax:

CSS max-height property. internetexplorer safari firefox opera chrome

View in Splitscreen»

Code-Editor:

Note-Its not mandatory to include both the minimum and maximum values.

Property Values

Value Description
none No value is defined. Its the default.
length To set the length in terms of px, cm, em etc.
percentage To set the value of max-height in terms of percentage of the containing block.
inherit The child element inherits the value of the parent element.

Specifications

Specs Value
Name max-height
Value <length> | <percentage> | none | inherit
Initial Value none
Applies to All elements expect inline nonreplaced elements and table elements
Javascript syntax object.style.maxHeight="20px"
Inherited No
Computed Value Same as declared Value
Browser Support internetexplorer safari firefox opera chrome

Related Examples.