XML technologies / CSS / Advanced websites with CSS / CSS property reference / max-height, min-height
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The properties max-height and min-height describe the maximum or minimum height an element may occupy. The browser first calculates the element’s height normally, then applies the limit.
When using max-height, set the property overflow to hidden; otherwise, the element’s contents may exceed the specified height.
Inherited: no
See also: height, max-width, min-width
Values
A CSS measurement, a percentage of the parent element’s content height, or, for max-height, the constant none.
Default value:
max-height:nonemin-height:0
Compatibility
CSS version: 2
Fully supported in Netscape 6, Opera 7 and later, and Mozilla.
Internet Explorer 6 for Windows supports only min-height for the table elements td, th and tr when table-layout is set to fixed (see table-layout). The CSS2 specification expressly states that this property must not apply to tables.
Example
The following rule restricts the element with the ID seitenleiste to a height between 200 and 1000 pixels and displays a scrollbar if its contents exceed the element’s maximum height:
#seitenleiste {
min-height: 200px;
max-height: 1000px;
overflow: auto;
}
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