CSSPropertyRule: syntax プロパティ
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.
syntax は CSSPropertyRule インターフェイスの読み取り専用プロパティで、 これは、 @property ルールによって表されるカスタムプロパティ登録のリテラル構文を返し、プロパティの値が計算値の時点でどのように解釈されるかを制御するものです。
値
文字列です。
例
このスタイルシートには、単一の @property ルールが格納されています。最初に返される CSSRule は、このルールを表す CSSPropertyRule となります。 syntax プロパティはリテラル文字列の "<color>" を返します。
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>"
仕様書
| Specification |
|---|
| CSS Properties and Values API Level 1> # dom-csspropertyrule-syntax> |
ブラウザーの互換性
Loading…