min-height
CSS
property sets the minimum height of an element. It prevents the
used value
of the
height
property from becoming smaller than the value specified for
min-height
.
The element's height is set to the value of
min-height
whenever
min-height
is larger than
max-height
or
height
.
/* <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(20em); /* Global values */ min-height: inherit; min-height: initial; min-height: unset;
<length>
min-height
as an absolute value.
<percentage>
min-height
as a percentage of the containing block's height.
auto
min-height
for the specified element.
max-content
min-height
.
min-content
min-height
.
fit-content(
<length-percentage>
)
fit-content
formula with the available space replaced by the specified argument, i.e.
min(max-content, max(min-content,
argument
))
.
| 初始值 |
auto
|
|---|---|
| 适用于 | all elements but non-replaced inline elements, table columns, and column groups |
| 继承 | no |
| 百分比 |
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
.
|
| 计算值 | the percentage as specified or the absolute length |
| 动画类型 | a length , percentage or calc(); |
auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)where
<length-percentage> = <length> | <percentage>
table { min-height: 75%; }
form { min-height: 0; }
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Box Sizing Module Level 4
The definition of 'min-height' in that specification. |
编者草案 | |
|
CSS Box Sizing Module Level 3
The definition of 'min-height' in that specification. |
工作草案 |
添加
max-content
,
min-content
,
fit-content
keywords.
|
|
CSS Level 2 (Revision 1)
The definition of 'min-height' in that specification. |
推荐 | 初始定义。 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
min-height
|
Chrome 完整支持 1 | Edge 完整支持 12 |
Firefox
完整支持
3
注意事项
|
IE
完整支持
7
注意事项
|
Opera
完整支持
4
注意事项
|
Safari 完整支持 1.3 | WebView Android 完整支持 4.4 | Chrome Android 完整支持 18 |
Firefox Android
完整支持
4
注意事项
|
Opera Android 完整支持 14 | Safari iOS 完整支持 1 | Samsung Internet Android 完整支持 1.0 |
auto
|
Chrome 完整支持 21 | Edge 完整支持 79 |
Firefox
不支持
16 — 22
注意事项
|
IE 不支持 No | Opera 完整支持 12.1 | Safari 不支持 No | WebView Android 完整支持 37 | Chrome Android 完整支持 25 |
Firefox Android
不支持
16 — 22
注意事项
|
Opera Android 完整支持 14 | Safari iOS 不支持 No | Samsung Internet Android 完整支持 1.5 |
fit-content
Experimental
|
Chrome 完整支持 46 | Edge 完整支持 79 |
Firefox
完整支持
3
Prefixed
注意事项
|
IE 不支持 No | Opera 完整支持 44 |
Safari
完整支持
11
|
WebView Android 完整支持 46 | Chrome Android 完整支持 46 |
Firefox Android
完整支持
4
Prefixed
注意事项
|
Opera Android 完整支持 43 |
Safari iOS
完整支持
11
|
Samsung Internet Android 完整支持 5.0 |
max-content
|
Chrome 完整支持 46 | Edge 完整支持 79 |
Firefox
完整支持
66
|
IE 不支持 No | Opera 完整支持 44 | Safari 完整支持 11 | WebView Android 完整支持 46 | Chrome Android 完整支持 46 |
Firefox Android
完整支持
66
|
Opera Android 完整支持 43 | Safari iOS 完整支持 11 | Samsung Internet Android 完整支持 5.0 |
min-content
|
Chrome 完整支持 46 | Edge 完整支持 79 |
Firefox
完整支持
66
|
IE 不支持 No | Opera 完整支持 44 | Safari 完整支持 11 | WebView Android 完整支持 46 | Chrome Android 完整支持 46 |
Firefox Android
完整支持
66
|
Opera Android 完整支持 43 | Safari iOS 完整支持 11 | Samsung Internet Android 完整支持 5.0 |
stretch
Experimental
|
Chrome
完整支持
28
Alternate Name
|
Edge
完整支持
79
Alternate Name
|
Firefox 不支持 No | IE 不支持 No |
Opera
完整支持
15
Alternate Name
|
Safari
完整支持
9
Alternate Name
|
WebView Android
完整支持
4.4
Alternate Name
|
Chrome Android
完整支持
28
Alternate Name
|
Firefox Android 不支持 No |
Opera Android
完整支持
15
Alternate Name
|
Safari iOS
完整支持
9
Alternate Name
|
Samsung Internet Android
完整支持
1.5
Alternate Name
|
完整支持
不支持
实验。期望将来行为有所改变。
见实现注意事项。
使用非标名称。
要求使用供应商前缀或不同名称。
height
margin-bottom
margin-left
margin-right
margin-top
margin-trim
max-height
max-width
min-height
min-width
overscroll-behavior
overscroll-behavior-block
overscroll-behavior-inline
overscroll-behavior-x
overscroll-behavior-y
padding
padding-bottom
padding-left
padding-right
padding-top
visibility
width