Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

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.

CSSRule CSSGroupingRule CSSConditionRule CSSSupportsRule

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 Stilregel enthält. Dies wird die erste CSSRule sein, die von 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

Siehe auch