Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/web/css/@property/inherits/index.md
6520 views
---
title: inherits slug: Web/CSS/@property/inherits page-type: css-at-rule-descriptor status: - experimental browser-compat: css.at-rules.property.inherits
---

{{CSSRef}}{{SeeCompatTable}}

The inherits CSS descriptor is required when using the {{cssxref("@property")}} at-rule and controls whether the custom property registration specified by @property inherits by default.

Syntax

@property --property-name { syntax: "<color>"; inherits: false; initial-value: #c0ffee; } @property --property-name { syntax: "<color>"; inherits: true; initial-value: #c0ffee; }

Values

  • true

    • : The property inherits by default.

  • false

    • : The property does not inherit by default.

Formal definition

{{cssinfo}}

Formal syntax

{{csssyntax}}

Examples

Add type checking to --my-color {{cssxref('--*', 'custom property')}}, as a color, a default value, and not allow it to inherit its value:

Using CSS {{cssxref('@property')}} at-rule:

@property --my-color { syntax: "<color>"; inherits: false; initial-value: #c0ffee; }

Using JavaScript {{domxref('CSS.registerProperty')}}:

window.CSS.registerProperty({ name: "--my-color", syntax: "<color>", inherits: false, initialValue: "#c0ffee", });

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also