颜色查找 | @media.color (Media Queries)

  •   CSS 中文开发手册

    颜色查找 | @media.color (Media Queries) - CSS 中文开发手册

    color CSS @media媒体功能可用于根据每个输出设备的RGB色彩分量(红色,绿色,蓝色)的比特的数量来应用样式。

    语法

    该color功能被指定为<integer>,值表示输出设备每个颜色分量(红,绿,蓝)的位数的值。如果设备不是彩色设备,则值为零。这是一个范围功能,也就是说,您也可以使用前缀min-color和max-color变量分别查询最小值和最大值。

    注:如果用不同的位数表示不同的颜色分量,则使用最小的数目。例如,如果显示器使用5位用于蓝色和红色,6位用于绿色,那么该设备被认为每种颜色组件使用5位。如果设备使用索引颜色,则使用颜色表中每个颜色分量的最小位数。

    请参阅使用CSS将颜色应用于HTML元素 以了解有关使用CSS将颜色应用于HTML更多信息。

    HTML

    <p>How many bits does your device support for color components?</p>

    CSS

    p {
      color: #000;
    }
    
    /* Any color device */
    @media (color) {
      p {
        color: #ff0000;
      }
    }
    
    /* Any color device with at least 8 bits per color component */
    @media (min-color: 8) {
      p {
        color: #35bd19;
      }
    }

    结果

    规范

    Specification

    Status

    Comment

    Media Queries Level 4The definition of 'color' in that specification.

    Working Draft

    The value can now be negative, in which case it computes to false.

    Media QueriesThe definition of 'color' in that specification.

    Recommendation

    Initial definition. The value must be nonnegative.

    浏览器兼容性

    Feature

    Chrome

    Firefox (Gecko)

    Internet Explorer

    Opera

    Safari

    Basic support

    (Yes)

    (Yes)

    ?

    (Yes)

    (Yes)

    Feature

    Android

    Firefox Mobile (Gecko)

    IE Mobile

    Opera Mobile

    Safari Mobile

    Basic support

    ?

    ?

    ?

    ?

    ?

  •   CSS 中文开发手册
    转载请保留页面地址:https://www.breakyizhan.com/css/32465.html
    原文地址:https://www.cnblogs.com/breakyizhan/p/13234148.html