CSSPropertyRule.inherits

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 inherits của giao diện CSSPropertyRule trả về cờ kế thừa của quy tắc thuộc tính CSS tùy chỉnh được đại diện bởi đối tượng @property. Giá trị này là true nếu thuộc tính này kế thừa theo mặc định, false nếu không.

Giá trị

Giá trị boolean.

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].inherits); // false

Thông số kỹ thuật

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

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