脚本 | @media.scripting
@media.scripting
该scripting
CSS @media
媒体功能可基于脚本(如JavaScript)是否可用来应用样式。
语法
该scripting
功能被指定为从下面的列表中选择的关键字值。
none
脚本在当前文档中完全不可用。
例子
HTML
<p class="script-none">You do not have scripting available. :-(</p>
<p class="script-initial-only">Your scripting is only enabled during the initial page load. Weird.</p>
<p class="script-enabled">You have scripting enabled! :-)</p>
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 |