concept

variable-cycle — CSS reference

For each element, custom-property references form dependency edges, including references inside fallback arguments. A cycle invalidates participating unregistered properties. Inherited custom properties are already computed on their parent, so this is not simply a global graph of names.

Formal Syntax & Structure

css syntaxcss
--a: var(--b); --b: var(--a);

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS substitution lab</title><style>body {margin:0} .sample {height:12px;background:#006050}#parent {width:300px} .sample {width:40px;height:30px;margin-bottom:4px;color:white}#parent{--a:var(--b);--b:var(--a)} #a{width:var(--a,60px)} #b{--x:var(--missing,var(--x));width:var(--x,80px)}</style><body><div id="parent"><div id="a" class="sample">A</div><div id="b" class="sample">B</div></div></body></html>
CSS Reference