How to store inherit value inside a CSS custom property (aka CSS variables)?
问题 Let's consider this simplified example in order to illustrate the issue: :root { --color:rgba(20,20,20,0.5); /*defined as the default value*/ } .box { width:50px; height:50px; display:inline-block; margin-right:30px; border-radius:50%; position:relative; } .red {background:rgba(255,0,0,0.5);} .blue {background:rgba(0,255,0,0.5);} .box:before{ content:""; position:absolute; top:0;left:0;right:0;bottom:0; border-radius:50%; transform:translateX(30px); background:var(--color); filter:invert(1);