HTML & CSS Wiki

READ MORE

HTML & CSS Wiki

The height property is used in CSS and certain HTML elements. It specifies the height of the content area of an element. The content area is inside the padding, border, and margin of the element.


Values[]

  • <length> - Examples of length units are pt, px, em, etc.
  • <percentage> - The <percentage> is calculated with respect to the height of the containing block. If the height of the containing block is not specified explicitly, the value computes to auto. A percentage height on the root element (e.g. <html>) is relative to the viewport.
  • auto - The browser will calculate and select a height for the specified element.


HTML example:

<h1 style="height:50px; width:100px;">
1st heading content.
</h1>


CSS example:

h1 {
    height:50px;
    width:100px;
}

See Also[]