I'm struggling to understand the following with CSS variables, I believe the code speaks for itself otherwise please let me know.
:root {
--color: red;
--hover-color: var(--color);
}
div {
--color: green;
background: var(--color);
}
div:hover {
background: var(--hover-color);
}
<div>
Why am I red on hover? Shouldn't I be green? When inspecting this element on hover, chrome shows the green color!?
</div>
What's absolutely baffling to me is that when inspecting the element in Chrome Devtools it shows the hover color as green??