CSSPropertyRule

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.

CSSPropertyRuleCSS プロパティと値 API のインターフェイスで、 CSS の @property ルールを表します。

CSSRule CSSPropertyRule

インスタンスプロパティ

祖先である CSSRule からプロパティを継承しています。

CSSPropertyRule.inherits 読取専用

カスタムプロパティの継承フラグを返します。

CSSPropertyRule.initialvalue 読取専用

カスタムプロパティの初期値を返します。

CSSPropertyRule.name 読取専用

カスタムプロパティの名前を返します。

CSSPropertyRule.syntax 読取専用

カスタムプロパティのリテラル構文を返します。

インスタンスメソッド

固有のメソッドはありません。祖先である CSSRule からプロパティを継承しています。

このスタイルシートには単一の @property ルールがあります。返される最初の CSSRule は、 CSS で定義された通りのプロパティと値を持つ CSSPropertyRule となります。

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

仕様書

Specification
CSS Properties and Values API Level 1
# the-css-property-rule-interface

ブラウザーの互換性

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
CSSPropertyRule
inherits
initialValue
name
syntax

Legend

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

Full support
Full support