在线文档教程
CSS

单色帧缓冲区​​中每像素的位数 | @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; } }

结果

规范

SpecificationStatusComment
Media Queries Level 4The definition of 'monochrome' in that specification.Working DraftThe value can now be negative, in which case it computes to false.
Media QueriesThe definition of 'monochrome' in that specification.RecommendationInitial definition. The value must be nonnegative.

浏览器兼容性

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support(Yes)(Yes)?(Yes)?

FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support?????