单色帧缓冲区中每像素的位数 | @media.monochrome
monochrome
CSS @media
媒体功能可用于基于在所述输出装置的单色帧缓冲器每像素的比特数来应用样式。
语法
该monochrome特征被指定为<integer>表示单色帧缓冲器中每个像素的位数。如果设备不是单色设备,则该值为零。这是一个范围功能,也就是说,您也可以使用前缀min-monochrome和max-monochrome变量分别查询最小值和最大值。
例子
HTML
<p>How many bits does your device support for monochrome pixels?</p>
CSS
/* Any monochrome device */
@media (monochrome) {
p {
color: #333;
}
}
/* Any non-monochrome device */
@media (monochrome: 0) {
p {
color: #ee3636;
}
}
结果
规范
Specification | Status | Comment |
---|---|---|
Media Queries Level 4The definition of 'monochrome' in that specification. | Working Draft | The value can now be negative, in which case it computes to false. |
Media QueriesThe definition of 'monochrome' in that specification. | Recommendation | Initial definition. The value must be nonnegative. |
浏览器兼容性
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | ? | (Yes) | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | ? | ? | ? | ? |