The height property

The height property sets an element height. The property value is any size units or the key property auto, which allows the browser to independently calculate the element size (default behavior).

Syntax

cssselector {
  height: value;
}

Example

Let's set the block height to 100px:

html<div id="elem"></div>
css#elem {
  border: 1px solid black;
  width: 300px;
  height: 100px;
}

Результат:

Example

Let's set the block height to 200px:

html<div id="elem"></div>
css#elem {
  border: 1px solid black;
  width: 300px;
  height: 200px;
}

Результат:

See also

  • the width property
    that can be used to set an element width
  • the height attribute
    that can be used to set an element height