DEV Community

Discussion on: Conditional logic with CSS – The CSS custom property trick.

Collapse
 
afif profile image
Temani Afif

That makes the variable --color-when-small contain two values: initial and red which is invalid --> this is false because the value will not contain initial. initial is not stored inside the --color variable. It's applied to --color and is making the latter invalid which will also make any variable referencing --color also invalid. (you can find the details here: w3.org/TR/css-variables-1/#using-v... note the is anything but the initial value) ... You also don't need to set --color:initial since it's the default value

Collapse
 
siddharthshyniben profile image
Siddharth

Thanks! I didn't know that. Will update the post.