CSS - height


The height sets the height of an element's content area.

Possible Values:

  • length: Any length unit. Negative length values are not permitted for this property.
  • percentage: The height is calculated with respect to the height of the element's containing block, assuming that the containing block's height has been explicitly set.
  • auto: Default. The browser calculates the actual height

Applies to:

All the HTML elements except non-replaced inline elements, table rows, and row groups.

DOM Syntax:



Here is the example:

<p style="width:400px; height:100px;border:1px solid red;
             padding:5px; margin:10px;">
This paragraph is 400pixels wide and 100 pixels high

This will produce following result:

This paragraph is 400pixels wide and 100 pixels high


Spacer Bottom Left Corner ImageBottom Right Corner Image
Valid XHTML 1.0 Strict  Valid CSS! Check the accessibility of this site according to U.S. Section 508