CSS height property
Examples
Set the height and width of a paragraph:
p.ex
{
height:100px;
width:100px;
}
{
height:100px;
width:100px;
}
try it"
In the bottom of this page for more examples.
Attribute definitions and instructions
Set the height of the element height attribute.
Note: height property does not include padding, borders, or margins!
Defaults: | auto |
---|---|
inherit: | no |
version: | CSS1 |
JavaScript syntax: | object .style.height = "50px" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Property Value
value | description |
---|---|
auto | default. Browser calculates the actual height. |
length | Use px, cm other units defined height. |
% | Based on the percentage of the height of the containing block-level object. |
inherit | Predetermined height should inherit the property value from the parent element. |
More examples
Using the set as a percentage of the image height
This example demonstrates how to use a percentage value to set the height of the element.
related articles
CSS tutorial: CSS a Dimension
CSS tutorial: CSS Box Model
CSS Reference: width attribute