脚本 | @media.scripting (Media Queries) - CSS 中文开发手册 - Break易站
2021-01-25 23:16
脚本 | @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 |
上一篇:背景大小 | background-size (Backgrounds & Borders) - CSS 中文开发手册 - Break易站
下一篇:规定灵活项目的方向 | flex-direction (Flexible Box Layout) - CSS 中文开发手册 - Break易站
文章标题:脚本 | @media.scripting (Media Queries) - CSS 中文开发手册 - Break易站
文章链接:http://soscw.com/index.php/essay/47018.html