`inherits` CSS at-rule descriptor
The inherits CSS descriptor of the @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.
The **`inherits`** [CSS](/docs/Web/CSS) descriptor of the @property [at-rule](/docs/Web/CSS/Guides/Syntax/At-rules) controls whether or not the registered [CSS custom property](/docs/Web/CSS/Reference/Properties/--*) inherits by default.
It is a required descriptor; if missing or invalid, the entire `@property` rule is invalid and ignored.
## Syntax
```css
/* Custom property does not inherit values */
inherits: false;
/* Custom property inherits values */
inherits: true;
```
### Values
- `true`
- : The property inherits by default.
- `false`
- : The property does not inherit by default.
## Formal definition
## Formal syntax
## Examples
### Setting inheritance behavior of a custom property
This example shows how to define a custom property `--my-color` that does not inherit its value from its parent elements:
```css
@property --my-color {
syntax: "<color>";
inherits: false;
initial-value: #c0ffee;
}
```
Using [JavaScript](/docs/Web/JavaScript) CSS.registerProperty():
```js
window.CSS.registerProperty({
name: "--my-color",
syntax: "<color>",
inherits: false,
initialValue: "#c0ffee",
});
```
## Specifications
## Browser compatibility
## See also
- Other @property descriptors: initial-value and syntax
- [Registering CSS custom properties](/docs/Web/CSS/Guides/Properties_and_values_API/Registering_properties)
- [CSS Properties and Values API](/docs/Web/API/CSS_Properties_and_Values_API)
- [CSS Painting API](/docs/Web/API/CSS_Painting_API)
- [CSS Typed Object Model](/docs/Web/API/CSS_Typed_OM_API)
- [Houdini APIs](/docs/Web/API/Houdini_APIs)
Cite this
"`inherits` CSS at-rule descriptor". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@property/inherits JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy