CSS heightProperty
Example
Set the height and width of a paragraph:
p.ex
{
height:100px;
width:100px;
}
{
height:100px;
width:100px;
}
Try it Yourself »
More examples at the bottom of this page.
Property definition and usage instructions
The height property sets the height of an element.
Note:The height property does not include padding, borders, or margins!
| Default value: | auto |
|---|---|
| Inherited: | no |
| version: | CSS1 |
| JavaScript Syntax: | object.style.height="50px" |
Browser Support
The numbers in the table indicate the first browser version that supports the property.
| Property | |||||
|---|---|---|---|---|---|
| height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Property value
| Value | Description |
|---|---|
| auto | Default. The browser calculates the actual height. |
| length | Sets the height using units such as px, cm, etc. |
| % | A percentage height based on the containing block-level object. |
| inherit | Specifies that the value of the height property should be inherited from the parent element. |
More Examples
Set the height of an image using a percentage
This example demonstrates how to set the height of an element using a percentage value.
Related Articles
CSS Tutorial:CSS Dimension
CSS Tutorial:CSS Box model
CSS Reference Manual:width attribute
other extensions