159 of 313 menu

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

selector { height: value; }

Example

Let's set the block height to 100px:

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

:

Example

Let's set the block height to 200px:

<div id="elem"></div> #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
byenru