Style height Property
The Style object
Definition and Usage
The height property sets or returns the height of an element.
The height property only takes effect on block-level elements or absolutely/fixed-positioned elements. Overflowing content can be constrained by the overflow property.
Syntax
Set the height property:
Object.style.height="auto|
length|%
|inherit"
Return the height property:
Object.style.height
| Value | Description |
|---|---|
| auto | Default. The height set by the browser. |
| length | Defines the height using units such as px, cm, etc. |
| % | Defines the height as a percentage of the parent element. |
| inherit | The height property value is inherited from the parent element. |
Browser support





All major browsers support the height 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 height of a button:
Try it »
The Style object