I'm using CSS variables, so that I can easily make sweeping changes. One of my variables is --gap: 15px, which I've used roughly 15 times so far. However, I now need to use the inverted value of --gap, which would be -15px.
Fails:
calc(0 - var(--gap))calc(var(--gap) * -1)
Works:
calc(var(--gap) - calc(var(--gap) * 2))
Questions:
The first attempt is clearly the most eloquent, but why doesn't work?
Is there a way to achieve this that is more eloquent than the third way?