min-height

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

Sumário

A propriedade min-height do CSS é usado para definir a altura mínima de um determinado elemento. Ele impede que o valor usado da propriedade height se torne menor que o valor especificado para min-height. O valor de min-height substitui os dois max-height e height.

Initial valueauto
Aplica-se aall elements but non-replaced inline elements, table columns, and column groups
Inheritednão
PercentagesThe 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.
Computed valuethe percentage as specified or the absolute length
Animation typea length, percentage or calc();

Sintaxe

sintaxe forma: 
min-height = 
auto |
<length-percentage [0,∞]> |
min-content |
max-content |
fit-content( <length-percentage [0,∞]> ) |
<calc-size()> |
<anchor-size()>

<length-percentage> =
<length> |
<percentage>

<calc-size()> =
calc-size( <calc-size-basis> , <calc-sum> )

<anchor-size()> =
anchor-size( [ <anchor-name> || <anchor-size> ]? , <length-percentage>? )

<calc-size-basis> =
<intrinsic-size-keyword> |
<calc-size()> |
any |
<calc-sum>

<calc-sum> =
<calc-product> [ [ '+' | '-' ] <calc-product> ]*

<anchor-name> =
<dashed-ident>

<anchor-size> =
width |
height |
block |
inline |
self-block |
self-inline

<calc-product> =
<calc-value> [ [ '*' | '/' ] <calc-value> ]*

<calc-value> =
<number> |
<dimension> |
<percentage> |
<calc-keyword> |
( <calc-sum> )

<calc-keyword> =
e |
pi |
infinity |
-infinity |
NaN

min-height: 3.5em
min-height: 10%
min-height: max-content
min-height: min-content
min-height: fit-content
min-height: fill-available

min-height: inherit

Valores

<length>

O valor fixo mínimo da altura. Veja <length> para possíveis unidades. Valores negativos fazem da declaração inválida.

<percentage>

O valor fixo mínimo da altura expressado como uma <percentage> do conteúdo da altura do bloco. Valores negativos fazem da declaração inválida.

max-content Experimental

The intrinsic preferred height.

min-content Experimental

The intrinsic minimum height.

fill-available Experimental

The containing block height minus horizontal margin, border and padding. Some browsers implement an ancient name for this keyword, available.

fit-content Experimental

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.

Exemplos

css
table {
  min-height: 75%;
}

form {
  min-height: 0;
}

Especificações

Specification
CSS Box Sizing Module Level 3
# width-height-keywords
CSS Box Sizing Module Level 4
# sizing-values
Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
min-height
anchor-size()
Experimental
auto
fit-content
fit-content()
Experimental
max-content
min-content
stretch
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
User must explicitly enable this feature.
Uses a non-standard name.
Requires a vendor prefix or different name for use.
Has more compatibility info.

Ver também