©
This document uses PHP Chinese website manual Release
monochrome:<integer>
接受min/max前缀:是
<integer>:
用整数值来定义宽度。不允许负值
本特性接受min和max前缀,因此可以派生出min-monochrome和max-monochrome两个媒体特性。
简单列举几个应用示例:
@media screen and (monochrome){ … } @import url(example.css) screen and (monochrome:0); <link media="screen and (min-monochrome:0) and (max-monochrome:10)" rel="stylesheet" href="example.css" /> <?xml-stylesheet media="not screen and (monochrome)" 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>monochrome of media features_CSS参考手册_web前端开发参考手册系列</title> <meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" /> <style> @media screen and (max-monochrome: 0){ .test::after { content: "彩色"; } } @media screen and (min-monochrome: 1){ .test::after { content: "单色的(黑白色)"; } } </style> </head> <body> <div class="test">你的输出设备是:</div> <script> </script> </body> </html>
点击 "运行实例" 按钮查看在线实例