CSS height
Property
Example
Set the height and width of a paragraph:
Property Definition and Usage
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 specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Property Values
Value | Description |
---|---|
auto | Default. The browser calculates the actual height. |
length | Defines the height using units like px, cm, etc. |
% | A percentage height relative to the containing block. |
inherit | Specifies that the height should be inherited from the parent element. |
More Examples
Set the height of an image using percentage
Related Articles
CSS Tutorial: CSS Dimension
CSS Tutorial: CSS Box model
CSS Reference: width Property