The Height Property

The Height Property

The height property sets the height of the element. As with the width property, the height property is seldom used with block-level elements, and its use in those cases may lead to some complications. This property is used most often with images.




<length> | auto



Applies to:

block-level and replaced elements





This property has two values:

  • Length – An absolute or relative value.

  • auto – This is the default.

Usually, you won't set the height of a block element explicitly; you set only the margins and padding. By default, the height has the value auto. The height is determined simply by how much room is needed to display the number of lines in the element.

Explicitly setting the height is even rarer than specifying the width. If you do and the text needs more space to display than you have allotted, a scroll bar or similar device may be introduced into the element by the browser so that the user can get to the text that is out of sight. If the height is more than that needed by the text in the element, the extra space is treated as padding.

     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows