CSS参考手册
媒体查询 | Media Queries
颜色索引 | @media.color-index
@media.color-index
该color-index
CSS @media
媒体功能可用于基于条目的输出设备的颜色查找表的数量应用样式。
语法
该color-index
功能被指定为<integer>
值表示输出设备的颜色查找表中的条目数量的值。(如果设备不使用这样的表,则此值为零)。这是一个范围特性,也就是说,也可以使用前缀min-color-index
和max-color-index
变量分别查询最小值和最大值。
实例
基本实例
HTML
<p>This is a test.</p>
CSS
p {
color: black;
}
@media (color-index) {
p {
color: red;
}
}
@media (min-color-index: 15000) {
p {
color: #1475ef;
}
}
结果
自定义样式表
此HTML将为至少有256种颜色的设备应用特殊的样式表。
<link rel="stylesheet" href="http://foo.bar.com/base.css" />
<link rel="stylesheet" media="all and (min-color-index: 256)" href="http://foo.bar.com/color-stylesheet.css" />
规范
Specification |
Status |
Comment |
---|---|---|
Media Queries Level 4The definition of 'color-index' in that specification. |
Working Draft |
The value can now be negative, in which case it computes to false. |
Media QueriesThe definition of 'color-index' in that specification. |
Recommendation |
Initial definition. The value must be nonnegative. |
浏览器兼容性
Feature |
Chrome |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari |
---|---|---|---|---|---|
Basic support |
(Yes) |
? |
? |
? |
? |
Feature |
Android |
Firefox Mobile (Gecko) |
IE Mobile |
Opera Mobile |
Safari Mobile |
---|---|---|---|---|---|
Basic support |
? |
? |
? |
? |
? |
媒体查询 | Media Queries相关
层叠样式表( Cascading Style Sheets )是一种用来表现 HTML 或 XML 等文件样式的计算机语言。CSS 不仅可以静态地修饰网页,还可以配合各种脚本语言动态地对网页各元素进行格式化。