首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

高度 | @viewport.height

heightCSS描述符是同时设置一个速记描述符min-heightmax-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-height0
  • max-heightnone
代码语言:txt
复制
Percentages as each of the properties of the shorthand:
  • min-height:百分比是根据生成的包含块的框%27s的高度计算的。如果未显式指定包含块的高度%28i。e.它取决于内容高度%29,并且该元素不是绝对定位的,百分比值被视为0
  • max-height:百分比是根据生成的包含块的框%27s的高度计算的。如果未显式指定包含块的高度%28i。e.它取决于内容高度%29,并且该元素不是绝对定位的,百分比值被视为none
代码语言:txt
复制
Media visual, continuous   [Computed value](../computed_value) as each of the properties of the shorthand:
  • min-height:指定的百分比或绝对长度
  • max-height:指定的百分比或绝对长度或none
代码语言:txt
复制
Canonical order order of appearance in the formal grammar of the values  

语法

代码语言:javascript
复制
/* One value */
height: auto;
height: 320px;
height: 15em;

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

auto使用的值是从其他CSS描述符的值中计算出来的。<length>非负的绝对或相对长度。<percentage>相对于初始视口宽度或高度的缩放因子1.0的百分比值,分别为水平和垂直长度。必须是非负的。

正式语法

代码语言:javascript
复制
<viewport-length>{1,2}where 
<viewport-length> = auto | <length-percentage>
where 
<length-percentage> = <length> | <percentage>

示例

代码语言:javascript
复制
@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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com