For the html:
<body>
<div>
<div>
<div>
...
</div>
</div>
</div>
</body>
Are there any ways to create a recursive variable that uses its parent's value:
body > div {
--x: 1;
}
div {
--x: calc(var(--x) + 1);
}
The above is not valid because css variables cannot have dependency cycles. Another invalid example:
body > div {
--is-even: 0;
--is-odd: 1;
}
div {
--is-even: var(--is-odd);
--is-odd: var(--is-even);
}
Are there any indirect ways to express such recursive variables in css?