inherits
Quick Summary for inherits (@property)
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Code Usage for inherits (@property)
@property --property-name {   syntax: '<color>';   inherits: false;   initial-value: #c0ffee; }  @property --property-name {   syntax: '<color>';   inherits: true;   initial-value: #c0ffee; } 
More Details for inherits (@property)

inherits

Experimental: This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.

The inherits CSS descriptor is required when using the @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

Related at-rule@property
Initial valueauto
Computed valueas specified

Formal syntax

true | false

Examples

Add type checking to --my-color custom property, as a color, a default value, and not allow it to inherit its value:

Using CSS @property at-rule:

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

Using JavaScript CSS.registerProperty:

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

Specifications

Specification
CSS Properties and Values API Level 1 # inherits-descriptor

See also

CSS Properties and Values API CSS Painting API CSS Typed Object Model CSS Houdini

Last modified: Aug 12, 2021, by MDN contributors

Select your preferred language English (US)中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
I believe that in order to better your knowledge base, it takes a lot of failing in order to succeed. I don't consider anything a failure as long as you get back up and you learn from your own mistakes.
Unknown
Random CSS Property

speak-as

The speak-as descriptor specifies how a counter symbol constructed with a given @counter-style will be represented in the spoken form. For example, an author can specify a counter symbol to be either spoken as its numerical value or just represented with an audio cue.
speak-as (@counter-style) css reference