Fandom

HTML & CSS Wiki

Max-height

648pages on
this wiki
Add New Page
Comments0 Share

The max-height property is used in CSS and certain HTML elements. This property allows a maximum height to be set for an element box. The calculation for the element's height may be less than this value, but if the calculated height value is above this value it will recompute the height using the max-height value as the new height value. If the value of min-height is greater than the value of max-height, the max-height property value becomes the min-height value.

ValuesEdit

  • inherit - Explicitly sets the value of this property to that of the parent.
  • none - No limit is placed on the maximum allowable height for the element.
  • <length> - Refers to an absolute measurement for the maximum computed element box height. Negative values are not allowed. Examples of lengths are px, em, etc.
  • <percentage> - Refers to a percentage of the height of the containing element block. If a height is not explicitly given for the containing block, it should be treated like auto.


HTML example:

<h1 style="max-height:20px;">
H1 content.
</h1>


CSS example:

h1 {
   max-height:20px;
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.