max-height

  • Revision slug: CSS/max-height
  • Revision title: max-height
  • Revision id: 25754
  • Created:
  • Creator: BijuGC
  • Is current revision? No
  • Comment /* Browser compatibility */

Revision Content

{{template.CSSRef()}}

Summary

The max-height property is used to set the maximum height of a given element. It prevents the used value of the {{template.Cssxref("height")}} property from becoming larger than the value specified for max-height.

  • {{template.Xref_cssinitial()}}: {{template.Cssxref("none")}}
  • Applies to: block level and replaced elements
  • {{template.Xref_cssinherited()}}: no
  • Percentages: refer to the height of the containing block
  • Media: {{template.Xref_cssvisual()}}
  • {{template.Xref_csscomputed()}}:

Syntax

max-height: <length> | <percentage> 

Values

  • none : the {{template.Cssxref("height")}} has no maximum value
  • length : can be in px, cm, in
  • percentage : % specified as a percentage of containing block's height

Examples

{{template.CSSRefExampleLink("max-height")}} (FIXME)

table { max-height: 75%; }

form { max-height: none; }

Notes

{{template.Cssxref("max-height")}} overrides height, but {{template.Cssxref("min-height")}} overrides {{template.Cssxref("max-height")}}.

Specifications

Browser compatibility

Browser Lowest Version
Internet Explorer 6
Firefox 1
Netscape 6
Opera 3.5
Safari ?

See also

box model, {{template.Cssxref("max-width")}}, {{template.Cssxref("-moz-box-sizing")}}, {{template.Cssxref("height")}}, {{template.Cssxref("min-height")}}

{{ wiki.languages( { "fr": "fr/CSS/max-height", "es": "es/CSS/max-height" } ) }}

Revision Source

<p> 
{{template.CSSRef()}}
</p>
<h3 name="Summary"> Summary </h3>
<p>The <code>max-height</code> property is used to set the maximum height of a given element.
It prevents the used value of the {{template.Cssxref("height")}} property from becoming larger than the value specified for <code>max-height</code>.
</p>
<ul><li> {{template.Xref_cssinitial()}}: {{template.Cssxref("none")}}
</li><li> Applies to: block level and replaced elements
</li><li> {{template.Xref_cssinherited()}}: no
</li><li> Percentages: refer to the height of the containing block
</li><li> Media: {{template.Xref_cssvisual()}}
</li><li> {{template.Xref_csscomputed()}}:
</li></ul>
<h3 name="Syntax"> Syntax </h3>
<pre class="eval">max-height: &lt;length&gt; | &lt;percentage&gt; 
</pre>
<h3 name="Values"> Values </h3>
<ul><li> <b>none</b> : the {{template.Cssxref("height")}} has no maximum value
</li><li> <b>length</b> : can be in px, cm, in 
</li><li> <b>percentage</b> : % specified as a percentage of containing block's height 
</li></ul>
<h3 name="Examples"> Examples </h3>
<p>{{template.CSSRefExampleLink("max-height")}} (FIXME)
</p>
<pre class="eval">table { max-height: 75%; }

form { max-height: none; }
</pre>
<h3 name="Notes"> Notes </h3>
<p>{{template.Cssxref("max-height")}} overrides height, but {{template.Cssxref("min-height")}} overrides {{template.Cssxref("max-height")}}.
</p>
<h3 name="Specifications"> Specifications </h3>
<ul><li> <a class="external" href="http://www.w3.org/TR/CSS2/visudet.html#min-max-heights">CSS 2.1</a>
</li></ul>
<h3 name="Browser_compatibility"> Browser compatibility </h3>
<table class="standard-table">
  <tbody><tr>
    <th>Browser</th>
    <th>Lowest Version</th>
  </tr>
  <tr>
    <td>Internet Explorer</td>
    <td>6</td>
  </tr>
  <tr>
    <td>Firefox</td>
    <td>1</td>
  </tr>

  <tr>
    <td>Netscape</td>
    <td>6</td>
  </tr>
  <tr>
    <td>Opera</td>
    <td>3.5</td>
  </tr>
  <tr>
    <td>Safari</td>
    <td>?</td>
  </tr>

</tbody></table>
<h3 name="See_also"> See also </h3>
<p><a href="en/CSS/box_model">box model</a>, {{template.Cssxref("max-width")}}, {{template.Cssxref("-moz-box-sizing")}}, {{template.Cssxref("height")}}, {{template.Cssxref("min-height")}}
</p>{{ wiki.languages( { "fr": "fr/CSS/max-height", "es": "es/CSS/max-height" } ) }}
Revert to this revision