CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES

CSS max-height Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The max-height CSS property specifies the maximum height of the content area of an element. This maximum height does not include padding, borders, or margins — see the CSS box model.

The following table summarizes the usages context and the version history of this property.

Default value: none
Applies to: All elements except non-replaced inline elements, table rows, and row groups
Inherited: No
Animatable: Yes. See animatable properties.
Version: CSS 2, 3

Syntax

The syntax of the property is given with:

max-height length | percentage | none | initial | inherit

The example below shows the max-height property in action.

p {
    max-height: 100px;
}
div {
    height: 200px;
    max-height: 100px;
}

Property Values

The following table describes the values of this property.

Value Description
length Specifies the maximum height as a length value in px, pt, cm, em, etc. Negative length values are not allowed.
percentage Specifies the maximum height in percentage. The percentage is calculated with respect to the height of the element's containing block. Negative percentage values are not allowed.
none The height has no maximum value. This is default value.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element max-height property.

Browser Compatibility

The max-height property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 7+
  • Apple Safari 1+
  • Opera 7+

Further Reading

See tutorial on: CSS Box Model, CSS Dimension.

Related properties: height, min-height.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties