CSSPropertyRule: syntax-Eigenschaft

Baseline 2024
Newly available

Since July 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Die schreibgeschützte syntax-Eigenschaft der Schnittstelle CSSPropertyRule gibt die wörtliche Syntax der benutzerdefinierten Eigenschaftsregistrierung zurück, die durch die @property-Regel dargestellt wird. Diese steuert, wie der Wert der Eigenschaft zur Berechnungszeit geparst wird.

Wert

Ein String.

Beispiele

Dieses Stylesheet enthält eine einzige @property-Regel. Die erste zurückgegebene CSSRule wird eine CSSPropertyRule sein, die diese Regel darstellt. Die syntax-Eigenschaft gibt den wörtlichen String "<color>" zurück.

css
@property --property-name {
  syntax: "<color>";
  inherits: false;
  initial-value: #c0ffee;
}
js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].syntax); //the string "<color>"

Spezifikationen

Specification
CSS Properties and Values API Level 1
# dom-csspropertyrule-syntax

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
syntax

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support