files/en-us/web/css/reference/at-rules/@property/inherits/index.md
The inherits CSS descriptor of the {{cssxref("@property")}} at-rule controls whether or not the registered CSS custom property inherits by default.
It is a required descriptor; if missing or invalid, the entire @property rule is invalid and ignored.
/* Custom property does not inherit values */
inherits: false;
/* Custom property inherits values */
inherits: true;
true
false
{{cssinfo}}
{{csssyntax}}
This example shows how to define a custom property --my-color that does not inherit its value from its parent elements:
@property --my-color {
syntax: "<color>";
inherits: false;
initial-value: #c0ffee;
}
Using JavaScript {{domxref('CSS.registerProperty_static', 'CSS.registerProperty()')}}:
window.CSS.registerProperty({
name: "--my-color",
syntax: "<color>",
inherits: false,
initialValue: "#c0ffee",
});
{{Specifications}}
{{Compat}}