此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

device-height

Deprecated

Avoid using this feature in new projects. Device media queries do not reflect available layout, only the physical size of the device. This feature may be a candidate for removal from web standards or browsers.

Consider using the following features instead: Media queries.

device-height CSS media feature 可以用来测试设备的渲染高度。注意,该条媒体查询将会在 媒体查询 level4(目前处于候选草案)中废弃

语法

device-height feature is specified as a <length> value. It is a range feature, meaning that you can also use the prefixed min-device-height and max-device-height variants to query minimum and maximum values, respectively.

例子

在高度低于 800px 时加载指定样式

html
<link
  rel="stylesheet"
  media="screen and (max-device-height: 799px)"
  href="http://foo.bar.com/short-styles.css" />

Specifications

规范
Media Queries Level 4
# device-height

Browser compatibility