CSS/Properties/max-height

From W3C Wiki
Jump to: navigation, search

max-height

The max-height property allow authors to constrain box heights to a certain range.

Description

Values <length> | <percentage> | none | inherit
Initial value none
Applies to All elements but non-replaced inline elements, table columns, and column groups
Inherited No


Values

  • <length>
    Specifies a fixed minimum computed height.


  • <percentage>
    Specifies a percentage for determining the used value. The percentage is calculated with respect to the height of the generated box's containing block.


  • none
    No limit on the height of the box.


  • inherit
    Takes the same specified value as the property for the element's parent.


Example

Example A

[style.css]

 p {
   width: 400px;
   height: auto;
   min-height: 50px;
   max-height: 200px;
   background-color: #666;
 }

[index.html]

<body>
  <p>This is a paragraph.</p>
</body>


CSS Reference

The CSS specification defines the max-height property in 10.7 Minimum and maximum heights.