html5 Site Icon CSS3 Site Icon CSS Site Icon

CSS 1/2 Reference

CSS max-height property


The CSS max-height property allows us to specify a maximum content height for a box model element.

Applies To

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

Property Values

negative values are NOT acceptable when using the CSS max-height property..

inherit - The element will inherit the max-height property of its parent element.

length - Defines a length value in a unit measurement such as em or pixel.

none - No limit set for the height of the box.

n% - A percentage value relative to the parent element where n is a number.

Default Value

Default value is set to none for the max-height property value.


The max-height property is NOT inherited from the parent element unless specified using the inherit property value.

Browser Anomalies

IE5, IE6 and IE7 do not support the inherit property value.
IE8 does with a valid !DOCTYPE.
IE9+ supports the inherit property value.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
<!-- Our HTML/CSS for the CSS max-height property follows -->
<html  xmlns="">
<title>CSS 1/2 Reference - CSS max-height Property</title>

<!-- Valid values for CSS max-height Property are:
	inherit, length, none and percentage value.

<style type="text/css">

#img1 {
  height: 200px;
  max-height: 150px;

#img2 {
  height: 200px;


<h1>CSS max-height Property</h1>
<h2>Image with height of 200, but max-height of 150 pixels</h2>
<img id="img1" src=""
    alt="Beef and Ale Pie" />Look at the image height.</p>
<h2>Same image with height of 200 pixels</h2>
<img id="img2" src=""
    alt="Beef and Ale Pie" />Look at the image height.</p>

How It Looks

The results of using the max-height property with the values above will look something like the following:

CSS margin-top    << Prev          Next >>   CSS max-width

go to home page Homepage go to top of page Top

CSS properties

The complete set of visual CSS properties from the latest 2.1 Specification.

Click the links for more information on individual properties and their values.