Note - Posted on

What happens when the var() CSS function references a custom property that is undefined or explicitly set to initial?

In both cases the custom property’s value is the guaranteed-invalid value. That’s the initial value of every custom property as defined in the spec. When var() encounters this value during substitution, here’s what happens:

  1. If a fallback was provided, the fallback value is used.
  2. If no fallback was provided, the referencing property becomes invalid at computed-value time (IACVT). The property then behaves as if its value had been specified as the unset keyword.

Posted on

← Back to the previous page