脚本 | @media.scripting (Media Queries) - CSS 中文开发手册 - Break易站

2021-01-25 23:16

阅读:619


  • ??CSS 中文开发手册

    脚本 | @media.scripting (Media Queries) - CSS 中文开发手册

    该scripting CSS @media媒体功能可基于脚本(如JavaScript)是否可用来应用样式。

    语法

    该scripting功能被指定为从下面的列表中选择的关键字值。

    none脚本在当前文档中完全不可用。

    initial-only在初始页面加载期间启用脚本,但不是之后。

    enabled当前文档支持并激活脚本。

    例子

    HTML

    You do not have scripting available. :-(

    Your scripting is only enabled during the initial page load. Weird.

    You have scripting enabled! :-)

    CSS

    p {
      color: lightgray;
    }
    
    @media (scripting: none) {
    ? .script-none {
    ?    color: red;
      }
    }
    
    @media (scripting: initial-only) {
    ? .script-initial-only {
    ?   color: red;
      }
    }
    
    @media (scripting: enabled) {
    ? .script-enabled {
    ?   color: red;
      }
    }

    结果

    规范

    Specification

    Status

    Comment

    Media Queries Level 4The definition of ‘scripting‘ in that specification.

    Working Draft

    Deferred to Media Queries Level 5.

    浏览器兼容性

    Feature

    Chrome

    Firefox (Gecko)

    Internet Explorer

    Opera

    Safari

    Basic support

    No support1

    No support2

    No support

    No support

    No support

    Feature

    Android

    Firefox Mobile (Gecko)

    IE Mobile

    Opera Mobile

    Safari Mobile

    Basic support

    No support

    No support

    No support

    No support

    No support

    
    
  • ??CSS 中文开发手册

  • 评论


    亲,登录后才可以留言!