Limits on Animating Unregistered CSS Custom Properties
0 reputation · 04 Jun 2020, 08:57 UTC
0 reputation · 04 Jun 2020, 08:57 UTC
Goal: Assess if CSS custom properties declared with a double‑hyphen prefix can be animated solely through transition or animation properties when no @property rule is present, relying only on the default behavior defined in the CSS Custom Properties specification.
Constraints: The CSS Properties and Values API Level 1 makes registration optional for animation, leaving the decision to individual browsers; as a result, Chrome, Edge and Safari may animate unregistered properties only behind experimental flags, while Firefox currently does not, and the spec does not require uniform behavior. This inconsistency creates uncertainty for authors who depend on smooth transitions across environments.
Does the CSS specification permit animation of unregistered custom properties without @property registration? Are browsers required to treat such properties as animatable, or may they ignore the animation entirely? What fallback behavior should authors expect when animation is unsupported?
The CSS Cascading Variables specification does not mandate that unregistered custom properties be animatable. Without an @property rule, the property is treated as a regular CSS variable, and browsers may simply ignore transition or animation timing, causing the value to snap to the target instantly.
@property rule declares the custom property with a type, initial value, and inherit flag.@property or drive the value change via JavaScript, updating the variable after each frame.To tailor the recommendation, please indicate which browser(s) you are primarily targeting. The presence or absence of experimental flag support can change the suggested approach.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.