Using Negative CSS Custom Properties

Posted on Jun 16, 2025

by Jimmy

CSS

How to convert a custom property into a negative value

CSS
        
            calc(var(--your-custom-property) * -1);        
    

So in context, it would look something like this:

CSS
        
            .class {
  margin-bottom: calc(var(--your-custom-property) * -1);
}        
    

Back to Snippets