--- title: height slug: conflicting/Web/CSS/@viewport translation_of: Web/CSS/@viewport translation_of_original: Web/CSS/@viewport/height original_slug: Web/CSS/@viewport/height ---
{{CSSRef}}

概要

高度 的 CSS 描述符是用於設定兩者的簡易描述符 {{cssxref("@viewport/min-height", "min-height")}} 與 {{cssxref("@viewport/max-height", "max-height")}} 的可視區域(viewport)。提供一個可視區域的長度值,將設定兩者的最小高度與最大高度的值。

如果提供了兩個可視區域(viewport),第一個值將設定為最小高度,而第二個值將設定為最大高度。

語法

/* One value */
height: auto;
height: 320px;
height: 15em;

/* Two values */
height: 320px 200px;

auto
使用 CSS 描述符來進行值的計算。
<length>
非負絕對值或相對長度。
<percentage>
初始可視區域的相對寬度或相對高度百分比的縮放係數為 1.0,且必須是非負數。

正式語法

{{csssyntax}}

舉例

@viewport {
  height: 500px;
}

格式

Specification Status Comment
{{SpecName('CSS3 Device', '#descdef-viewport-height', '"height" descriptor')}} {{Spec2('CSS3 Device')}} Initial definition

瀏覽器兼容性

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 29 (behind a flag) {{CompatNo}} 10 {{property_prefix("-ms")}} 11.10
Removed in 15
Reintroduced behind a flag in 16
{{CompatNo}}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 4.4 29 {{CompatNo}} 10{{property_prefix("-ms")}} 11.10
Removed in 15
Reintroduced behind a flag in 16
{{CompatNo}}