XML technologies / CSS / Advanced websites with CSS / CSS property reference / height
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The property height describes the height of a block element or an element replaced from an external source. A replaced element’s appearance is determined by an external source: for example, images through elements img, plugins through elements object, and text input fields through elements input and select. Another type of replaced element is content inserted inline by CSS pseudo-elements. The height excludes padding, border and margin.
If the content of a block element is taller than its assigned value of height, the result depends on the CSS property overflow.
Inherited: No.
See also: max-height, min-height, overflow, width
Values
An absolute CSS measurement, a percentage calculated from the parent element’s height, or the constant auto.
Default value: auto
Compatibility
CSS version: 1
Works in most current browsers (Netscape 6, Opera 7, Mozilla and Internet Explorer 5 for Macintosh), with limitations in older browsers.
Internet Explorer for Windows, up to version 6.0, incorrectly includes padding, border and margin in height calculations. Version 6.0 avoids this error in Standards-Compliant Mode. All older versions therefore require a separate stylesheet or acceptance of a reduced displayed height.
Internet Explorer 4 supports this property only for certain block elements, such as div.
Netscape 4 supports this property only for images and elements positioned with absolute.
Example
The following style rule gives all paragraphs with ID textbaustein a fixed height of 100 pixels:
#textbaustein p {
height: 100px;
}
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg