HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Set the maximum height of a <div> element
The maxHeight property sets or returns the maximum height of an element.
The maxHeight property has effect only on block-level elements or on elements with absolute or fixed position.
Property | |||||
---|---|---|---|---|---|
maxHeight | Yes | Yes | Yes | Yes | Yes |
Return the maxHeight property:
Set the maxHeight property:
Value | Description |
---|---|
none | No limit on the height of the element. This is default |
length | Defines the maximum height in length units |
% | Defines the maximum height in % of the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | none |
---|---|
Return Value: | A String, representing the maximum height of an element |
CSS Version | CSS2 |
Return the maximum height of a <div> element:
alert(document.getElementById("myDIV").style.maxHeight);
CSS tutorial: CSS Dimension
CSS reference: max-height property