?
This document uses PHP Chinese website manual Release
monochrome:<integer>
接受min/max前綴:是
<integer>:
用整數(shù)值來定義寬度。不允許負(fù)值
本特性接受min和max前綴,因此可以派生出min-monochrome和max-monochrome兩個(gè)媒體特性。
簡(jiǎn)單列舉幾個(gè)應(yīng)用示例:
@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參考手冊(cè)_web前端開發(fā)參考手冊(cè)系列</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">你的輸出設(shè)備是:</div> <script> </script> </body> </html>
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例