tech/webdev magazine

September 23, 2019

Logical Operations with CSS Variables

Monday, September 23, 2019 Teklinks No comments

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.

Full article


Post a Comment