Logical Operations with CSS Variables

1 · CSS-Tricks · Sept. 11, 2019, 3:17 p.m.
Very often, while using switch variables (a variable that's either 0 or 1, a concept that's explained in a greater detail in in this post), I wish I could perform logical operations on them. We don't have functions like not(var(--i)) or and(var(--i), var(--k)) in CSS, but we can emulate these and more with arithmetic operations in a calc() function. This article is going to show you what calc() formulas we need to use for each logical operation and … Read article The post Logical Operations wit...