I have found something a bit strange, and could not find anything in the CSS custom properties spec about that. Here is a simple example: https://codepen.io/bakura10/pen/RwxNPxz
:root {
--background: red;
}
.test {
position: relative;
}
.test::before {
content: '';
width: 100%;
height: 100%;
top: 0;
left: 0;
background: var(--background);
}
<div class="test">
TEST
</div>
As you can see, despite the variable --background being defined at the root scope, it is simply not accessible from the before or after pseudo element.
Why is that so?