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
When i was a little kid, I was really scared of the dark. But then I came to understand, dark just means the absence of photons in the visible wavelength -- 400 to 700 nanometers. Then i thought, well, its really silly to be afraid of a lack of photons. Then i wasn't afraid of the dark anymore after that.
Elon Musk
Random CSS Property

text-transform

The text-transform CSS property specifies how to capitalize an element's text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized. It also can help improve legibility for ruby.
text-transform css reference