@property
A CSS rule that registers a custom property with a type, an initial value and whether it inherits.
In more detail
Registration can also be done in JavaScript with CSS.registerProperty(). Because the browser then knows the value is, for example, a colour or a length, it can check it and animate between values, which plain custom properties cannot do.
Example
@property --angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }Related terms
- CSS custom property — A property you define yourself with a double-hyphen name, such as --brand: #0066cc, and read elsewhere with var(--brand).
- CSS animation — Changing an element's styles smoothly over time using @keyframes and the animation property, without JavaScript.
Taught in
- CSS Custom Properties: Scoping, Fallbacks And Theming — Frontend Architecture & Web Platform