©
This document uses PHP Chinese website manual Release
device-height:<length>
<length>:
用长度值来定义高度。不允许负值
本特性接受min和max前缀,因此可以派生出min-device-height和max-device-height两个媒体特性。
简单列举几个应用示例:
@media screen and (device-height:800px){ … } @import url(example.css) screen and (min-device-height:800px); <link media="screen and (min-device-height:300px) and (max-device-height:900px)" rel="stylesheet" href="example.css" />
Values | IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|---|
Basic Support | 6.0-8.0 | 2.0-3.0 | 4.0-25.0#1 | 6.0#1 | 15.0+ | 6.0-6.1#1 | 2.1-4.3#1 | 18.0-24.0#1 |
9.0-11.0#1 | 3.5+ | 26.0+ | 6.1+ | 7.0+ | 4.4+ | 25.0+ |
不支持嵌套媒体查询。
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8" /> <title>media features device-height_CSS参考手册_web前端开发参考手册系列</title> <meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" /> <style> @media screen and (min-device-height:800px){ body{color:#f00;} } </style> </head> <body> <div class="test">当你的输出设备分辨率高度设置为800px时,本行文字显示为红色</div> </body> </html>
点击 "运行实例" 按钮查看在线实例