CSSSupportsRule
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.
Das CSSSupportsRule
-Interface repräsentiert eine einzelne CSS-@supports
-At-Regel.
Instanzeigenschaften
Erbt Eigenschaften von seinen Vorfahren CSSConditionRule
, CSSGroupingRule
, und CSSRule
.
Instanzmethoden
Erbt Methoden von seinen Vorfahren CSSConditionRule
, CSSGroupingRule
, und CSSRule
.
Beispiele
Das CSS enthält eine CSS-Feature-Abfrage mit der @supports
-At-Regel, die eine einzige Stilregel beinhaltet. Dies wird die erste CSSRule
sein, die durch document.styleSheets[0].cssRules
zurückgegeben wird.
myRules[0]
gibt daher ein CSSSupportsRule
-Objekt zurück.
css
@supports (display: grid) {
body {
color: blue;
}
}
js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0]); // a CSSSupportsRule representing the feature query.
Spezifikationen
Specification |
---|
CSS Conditional Rules Module Level 3> # the-csssupportsrule-interface> |
Browser-Kompatibilität
Loading…