Height

Category:CSS Properties

Height

The height property specifies the height of the content area an element. The height of an element does not include padding, borders, or margins. Height can be defined in percentage (of the width of the containing block), pixels, cm, etc.

Examples

Height in pixels

Set the height of a <p> element to 100 px.

p{
  height: 100px;
}

Height as a percentage

Setting the height of an <img> element using a percent value.

img {
  width: 50%;
}

Syntax

height: value;

Tips

  • The height property does not include padding, borders, or margins.
  • The default value of the height is auto: the element will automatically adjust its height to allow its content to be displayed correctly.

Additional Information

For more information, see http://www.w3schools.com/cssref/pr_dim_height.asp

Found a bug in the documentation? Let us know at documentation@code.org