Get in touch

Send an email to:
Or find me online at: Github, X

Negate a CSS variable

To use the negative value of a CSS variable we have to wrap it in the calc function and multiply the value by -1

:root {
  --margin: 20px;

.container {
  margin-left: calc(var(--margin) * -1);

Just adding - in front of the variable like this -var(--margin) will not work.