v136 · css
Type-agnostic var() fallback
The fallback part of a var() function does not validate against the type of the custom property being referenced.
concepts
-
Type-agnostic var()
var() fallback values no longer have to match the variable's registered type. Lets authors mix typed and untyped fallbacks in the same expression.
-
Registered property rescue
Real-world pattern: a typed registered property with a gradient fallback. Pre-136 the fallback was dropped; 136+ keeps it as long as it's syntactically valid.
-
Fallback Type Matrix
One registered
--brand: <color>property crossed against six fallback shapes — literals, gradients, calc(), even a mismatched length — with computed-style readouts. -
Design Token Debugger
Register a typed
@propertytoken (color, length, number) and configure it as defined, undefined, or invalid. The debugger shows the computed value for fivevar()expressions with type-mismatched fallbacks — gradient, rgba, keyword — proving Chrome 136's type-agnostic fallback rule live. -
Theme Escape Hatch
A component registers
--card-bgas<color>. Design themes supply gradients and token chains as fallbacks — a type mismatch. Chrome 136's type-agnostic rule uses the gradient; pre-136 falls to the registered initial. Three theme modes with a computed-value inspector. -
Fallback Chain
A three-link
var(--a, var(--b, var(--c, #literal)))chain where each token can be defined, undefined, or a gradient (type mismatch). Step-by-step resolution trace shows where Chrome 136's type-agnostic rule diverges from the old IACVT behaviour.
why it shipped
A var() function can provide fallback value, in case the referenced custom property does not exist (or is invalid in some other way):