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.

Thuộc tính chỉ đọc syntax của giao diện CSSPropertyRule trả về cú pháp theo nghĩa đen của quy tắc thuộc tính CSS tùy chỉnh được đại diện bởi đối tượng @property. Đây là một chuỗi.

Giá trị

Chuỗi.

Ví dụ

Stylesheet này chứa một đơn @property. CSSPropertyRule đầu tiên được trả về sẽ đại diện cho thuộc tính này.

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

Thông số kỹ thuật

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

Tương thích trình duyệt