CSS max-height Property


In CSS, the max-height property is used to specify the maximum height of an element. If the element's content exceeds the specified maximum-height, it will overflow; otherwise, it has no effect. If the element's content is too small, it has no effect. The max-height property can override the height property value.

Syntax

Example

Preview

Property Values

Value Description
none There is no maximum width. This is the default setting.
length Defines the maximum width in pixels, centimeters, and so on. Learn more about length units.
% Defines the maximum width of the containing block in percentage terms.
initial This property is set to its default value.
inherit This property is inherited from its parent element.

Supported Browsers

Property Chrome Firefox Safari Edge / IE Opera
max-height 1.0 1.0 2.0 7.0 7.0