Is it possible to override the local CSS variable with a global variable?
As we know vice-versa is always possible. Can someone help if there is anything like !important
to override the local variable.
Taking the below example, want red
to have more precedence than blue
.
:root{
--primarycolor: red !important; /*Like this*/
}
body {
color: var(--primarycolor);
border:2px solid var(--primarycolor);
padding:5px;
}
div{
--primarycolor: blue; /*Want to override this*/
color: var(--primarycolor);
border:2px solid var(--primarycolor);
padding:5px;
}
Check all border color - I am in body
<div>I am in div</div>