高度 | @viewport.height
@viewport.height
height
CSS描述符是同时设置一个速记描述符min-height
和max-height
视口。通过提供一个视口长度值将把所提供的值设置为最小高度和最大高度。
如果提供了两个视口值,则第一个值将设置最小高度,第二个值将设置最大高度。
Related at-rule | @viewport |
---|---|
初始值 | as each of the properties of the shorthand: min-height: 0 max-height: none |
Percentages | as each of the properties of the shorthand: min-height: 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. max-height: 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 none. |
适用媒体 | visual, continuous |
计算值 | as each of the properties of the shorthand: min-height: the percentage as specified or the absolute length max-height: the percentage as specified or the absolute length or none |
正规顺序 | order of appearance in the formal grammar of the values |
min-height
:0
max-height
:none
Percentages as each of the properties of the shorthand:
min-height
:百分比是根据生成的包含块的框%27s的高度计算的。如果未显式指定包含块的高度%28i。e.它取决于内容高度%29,并且该元素不是绝对定位的,百分比值被视为0
。
max-height
:百分比是根据生成的包含块的框%27s的高度计算的。如果未显式指定包含块的高度%28i。e.它取决于内容高度%29,并且该元素不是绝对定位的,百分比值被视为none
。
Media visual, continuous [Computed value](../computed_value) as each of the properties of the shorthand:
min-height
:指定的百分比或绝对长度
max-height
:指定的百分比或绝对长度或none
Canonical order order of appearance in the formal grammar of the values
语法
/* One value */
height: auto;
height: 320px;
height: 15em;
/* Two values */
height: 320px 200px;
值
auto使用的值是从其他CSS描述符的值中计算出来的。<length>非负的绝对或相对长度。<percentage>相对于初始视口宽度或高度的缩放因子1.0的百分比值,分别为水平和垂直长度。必须是非负的。
正式语法
<viewport-length>{1,2}where
<viewport-length> = auto | <length-percentage>
where
<length-percentage> = <length> | <percentage>
示例
@viewport {
height: 500px;
}
规范
Specification | Status | Comment |
---|---|---|
CSS Device AdaptationThe definition of '"height" descriptor' in that specification. | Working Draft | Initial definition |
浏览器兼容性
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 29 (behind a flag) | No support | 10 -ms | 11.10 Removed in 15 Reintroduced behind a flag in 16 | No support |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 4.4 | 29 | No support | 10-ms | 11.10 Removed in 15 Reintroduced behind a flag in 16 | No support |