CSSPropertyRule:inherits 属性
>CSSPropertyRule 接口的只读属性 inherits 返回由 @property 规则表示的自定义属性注册的继承标志,即用于描述该属性是否默认继承的布尔值。
值
布尔值。
示例
下面的样式表包含一个 @property 规则。返回的第一个 CSSRule 将是一个代表此规则的 CSSPropertyRule。inherits 属性返回等于 CSS 中 inherits 属性的布尔值 false。
css
@property --property-name {
syntax: "<color>";
inherits: false;
initial-value: #c0ffee;
}
js
const myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].inherits); // false
规范
| 规范 |
|---|
| CSS Properties and Values API Level 1> # dom-csspropertyrule-inherits> |