From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/css/min-height/index.html | 111 ++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 files/zh-cn/web/css/min-height/index.html (limited to 'files/zh-cn/web/css/min-height') diff --git a/files/zh-cn/web/css/min-height/index.html b/files/zh-cn/web/css/min-height/index.html new file mode 100644 index 0000000000..29775ae7f5 --- /dev/null +++ b/files/zh-cn/web/css/min-height/index.html @@ -0,0 +1,111 @@ +--- +title: min-height +slug: Web/CSS/min-height +translation_of: Web/CSS/min-height +--- +
{{CSSRef}}
+ +

CSS 属性 min-height 能够设置元素的最小高度。这样能够防止 {{cssxref("height")}} 属性的应用值小于 min-height 的值。

+ +
{{EmbedInteractiveExample("pages/css/min-height.html")}}
+ + + +

min-height 大于 {{cssxref("max-height")}} 或 {{cssxref("height")}} 时,元素的高度会设置为 min-height 的值。

+ +

语法

+ +
/* <长度> 数值 */
+min-height: 3.5em;
+
+/* <百分比> 数值 */
+min-height: 10%;
+
+/* 关键词 */
+min-height: max-content;
+min-height: min-content;
+min-height: fit-content(20em);
+
+/* 全局数值 */
+min-height: inherit;
+min-height: initial;
+min-height: unset;
+
+ +

Values

+ +
+
{{cssxref("<length>")}}
+
定义 min-height 为一个绝对数值。
+
{{cssxref("<percentage>")}}
+
定义 min-height 为一个相对于父容器高度的百分数。
+
auto
+
浏览器将通过计算为指定元素选择一个 min-height 值。
+
none
+
不限制盒容器的尺寸。
+
max-content
+
The intrinsic preferred min-height.
+
min-content
+
The intrinsic minimum min-height.
+
fit-content({{cssxref("<length-percentage>")}})
+
Uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)).
+
+ +

Formal definition

+ +

{{cssinfo}}

+ +

Formal syntax

+ +
{{csssyntax}}
+ +

示例

+ +

Setting min-height

+ +
table { min-height: 75%; }
+
+form { min-height: 0; }
+
+ +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('CSS4 Sizing', '#width-height-keywords', 'min-height')}}{{Spec2('CSS4 Sizing')}}
{{SpecName('CSS3 Sizing', '#width-height-keywords', 'min-height')}}{{Spec2('CSS3 Sizing')}}Adds the max-content, min-content, fit-content keywords.
{{SpecName('CSS2.1', 'visudet.html#min-max-heights', 'min-height')}}{{Spec2('CSS2.1')}}Initial definition.
+ +

浏览器兼容性

+ + + +

{{Compat("css.properties.min-height")}}

+ +

相关链接

+ + -- cgit v1.2.3-54-g00ecf