Repository navigation
Description
Description
I will quote a few parts from the specification that should give clear description of the feature:
[css-variables] provides primitive means for defining user-controlled properties, however these properties always take token lists as values, must always inherit, and can only impact document layout or paint by being re-incorporated into the value of other properties via a var() reference.
This specification extends [css-variables], allowing the registration of properties that have a value type, an initial value, and a defined inheritance behaviour
@property --size {
syntax: "<length>";
inherits: false;
initial-value: 0px;
}Rationale
-
A better way to animate things: Registered custom properties allow us to animate almost anything.
-
Syntax validation: A non-registered custom property can contain any value which can easily lead to errors. A registered custom property follow a syntax and cannot accept any values.
A custom property can become a registered custom property, making it act more like a UA-defined property: giving it a syntax that’s checked by the UA, an initial value, and a specific inheritance behavior.
- Better JavaScript manipulation: Unregistered custom properties are mainly strings so we are obliged to do an extra manipulation to get their data. With registered custom properties we no more have such issue. Below a screenshot to illustrate the difference:
-
Chromium browser support this feature since too long (https://ishoudinireadyyet.com/) which leads us to the famous "Chrome-only" demos so it would be good to have a better support for such feature
-
It's part of the Houdini project so it closely linked to other features like the Paint API and the Layout API.
This specification is complementary to [css-paint-api-1] and [css-layout-api-1], which allow custom properties to directly impact paint and layout behaviours respectively.
Specification
Tests
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsProposed

Activity
Afif13 commentedon Sep 26, 2022
Here an article where I am exploring the power of
@propertyin creating complex animation without using keyframes: https://css-tricks.com/build-complex-css-transitions-using-custom-properties-and-cubic-bezier/Afif13 commentedon Sep 26, 2022
Back in 2018, Ana Tudor (@thebabydino) explored Gradients animation using this feature: https://css-tricks.com/the-state-of-changing-gradients-with-css-transitions-and-animations/
More articles around this:
lilles commentedon Sep 29, 2022
Regarding tests, I don't think we should filter out tests without "property".
We should exclude this test unless typed om also becomes part of Interop 2023: https://wpt.fyi/results/css/css-properties-values-api/typedom.html
The crashtests directory probably doesn't make sense to add (even if all engines would typically pass).
There are some subtests that rely on other features that engines don't necessarily ship. I recently added a cycle test for the lh unit in unit-cycles.html, for instance.
andruud commentedon Oct 31, 2022
We may want to exclude tests which cover:
<transform>,<transform-list>, because we can't currently represent computed values of interpolated transforms which contain percentages. (It's possible with the newly addedmix()function, but should probably not scope-creep that into this proposal).<image>, unless we now have good specs for how generated images should interpolate. Last time a looked, we did not, but that's a while ago now.foolip commentedon Nov 11, 2022
Custom properties or variables came up a fair bit in the State of CSS 2022 question about browser incompatibilities, mentioned in ~2% of responses, see #248. Examples from those responses:
@media (min-width: var(--small))@property)@propertyis missing from Safari and Firefox.foolip commentedon Nov 11, 2022
In the MDN short survey on CSS & HTML, "CSS custom properties (
@property)" was selected by ~28% of survey takers, putting it in the top third of the 20 options. (There is some uncertainty as with any survey data.)foolip commentedon Feb 1, 2023
Thank you for proposing
@propertyfor inclusion in Interop 2023.We are pleased to let you know that this proposal was accepted as the Custom Properties focus area. You can follow the progress of this Focus Area on the Interop 2023 dashboard.
For an overview of our process, see the proposal selection summary. Thank you for contributing to Interop 2023!
Posted on behalf of the Interop team.
SebastianZ commentedon Feb 4, 2023
I guess that meant Custom Properties, not Container Queries.
Sebastian
foolip commentedon Feb 5, 2023
Yes, of course! Sorry about the copypasta.