©
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
device-aspect-ratio:<ratio>
<ratio>:指定比率
如常讲的显示器屏幕比率:4/3, 16/9, 16/10
本特性接受min和max前缀,因此可以派生出min-device-aspect-ratio和max-device-aspect-ratio两个媒体特性。
简单列举几个应用示例:
@media screen and (device-aspect-ratio:4/3){ … } @import url(example.css) screen and (min-device-aspect-ratio:4/3);
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8" /> <title>media features device-aspect-ratio_CSS参考手册_web前端开发参考手册系列</title> <meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" /> <style> @media screen and (device-aspect-ratio:16/10){ body{color:#f00;} } </style> </head> <body> <div class="test">当你将输出设备屏幕分辨率为16:10时,本行文字显示为红色</div> <script> </script> </body> </html>
点击 "运行实例" 按钮查看在线实例