concept

invalid-at-computed-value-time — CSS reference

A declaration using var() can survive parsing and win the cascade, then fail when its substituted tokens do not match the receiving property. For ordinary properties this gives the unset-like result: inherited value or initial value. An earlier competing declaration is not recovered. A var() fallback does not repair an existing custom property whose tokens are unsuitable for the receiving property.

Formal Syntax & Structure

css syntaxcss
color: var(--theme-color, teal);

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>#parent {color:#184168;--bad:12px} #a {color:#006050;color:var(--bad,#006050);background-color:red;background-color:var(--bad)} #b {color:#006050;color:12px}</style><body><div id="parent"><div id="a">Sample</div><div id="b">Comparison</div></div></body></html>
CSS Reference