W3cubDocs

/CSS

min-height

The min-height property is used to set the minimum height of a given element. It prevents the used value of the height property from becoming smaller than the value specified for min-height.

The value of min-height overrides both max-height and height.

Initial value 0
Applies to all elements but non-replaced inline elements, table columns, and column groups
Inherited no
Percentages The percentage is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the percentage value is treated as 0.
Media visual
Computed value the percentage as specified or the absolute length
Animation type a length, percentage or calc();
Canonical order the unique non-ambiguous order defined by the formal grammar

Syntax

/* <length> value */
min-height: 3.5em;

/* <percentage> value */
min-height: 10%;

/* Keyword values */
min-height: max-content;
min-height: min-content;
min-height: fit-content;
min-height: fill-available;

/* Global values */
min-height: inherit;
min-height: initial;
min-height: unset;

Values

<length>
The fixed minimum height. See <length> for possible units. Negative values make the declaration invalid.
<percentage>
The fixed minimum height expressed as a <percentage> of containing block's height. Negative values make the declaration invalid.
auto
The default minimum size for flex items, providing a more reasonable default than 0 for other layouts.
max-content
The intrinsic preferred height.
min-content
The intrinsic minimum height.
fill-available
The containing block height minus horizontal margin, border and padding. Some browsers implement an ancient name for this keyword, available.
fit-content
According CSS3 Box, this is a synonym of min-content. CSS3 Sizing defines a more complex algorithm, but no browser implements it, even in an experimental way.

Formal syntax

<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available

Examples

table { min-height: 75%; }

form { min-height: 0; }

Specifications

Specification Status Comment
CSS Intrinsic & Extrinsic Sizing Module Level 3
The definition of 'min-height' in that specification.
Working Draft Adds the max-content, min-content, fit-content, and fill-available keywords.
Both CSS3 Box and CSS3 Writing Modes drafts defined at some point these keywords. These drafts are superseded by this spec.
CSS Flexible Box Layout Module
The definition of 'min-height' in that specification.
Candidate Recommendation Added the auto keyword and used it as the initial value.
CSS Transitions
The definition of 'min-height' in that specification.
Working Draft Defines min-height as animatable.
CSS Level 2 (Revision 1)
The definition of 'min-height' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 (Yes) 3.0 (1.9) 7.0 [3] 4.0 1.0
2.0.2 (416) for positioned elements
applies to <table> [1] No support ? (Yes) No support (Yes) No support
max-content, min-content, fit-content, and fill-available No support ? No support No support No support 9
autoObsolete since Gecko 22 21.0 ? 16.0 (16.0) No support 12.10 No support
auto as initial valueObsolete since Gecko 22 21.0 ? 18.0 (18.0) No support 12.10 No support
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? (Yes) ? ? ? 9

[1] CSS 2.1 explicitly leaves the behavior of min-height with <table> undefined. Therefore any behavior is CSS2.1-compliant; newer CSS specifications may define this behavior, so Web developers shouldn't rely on a specific one now.

[2] Due to bug (bug 307866) Firefox doesn't handle min-height on elements with display: table-*.

[3] In Internet Explorer 10-11 (but not 12+), a min-height declaration on a column-direction flex container doesn't apply to the container's flex items. See Flexbug #3 for more info.

See also

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/min-height