--- title: height slug: Web/CSS/@viewport/height translation_of: Web/CSS/@viewport translation_of_original: Web/CSS/@viewport/height ---
height CSS 属性是同时设置可视区 {{cssxref("@viewport/min-height", "min-height")}} and {{cssxref("@viewport/max-height", "max-height")}} 的简写。当你设置一个值的时候,最小高度(minimum height)和最大高度(maximum height)会被同时设置。如果提供两个值,第一个值会被设置为最小高度,第二个值将会被设置为最大高度。
/* One value */ height: auto; height: 320px; height: 15em; /* Two values */ height: 320px 200px;
auto<length><percentage>{{cssinfo}}
{{csssyntax}}
@viewport {
height: 500px;
}
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('CSS3 Device', '#descdef-viewport-height', '"height" descriptor')}} | {{Spec2('CSS3 Device')}} | 初始定义 |
{{Compat("css.at-rules.viewport.height")}}