-2

I have a css variable:

:root {
    --report-padding-top: 50;
    --report-margin-header: calc(var(--report-padding-top) * -1);
}

Can I do this?

.header {
    margin-top: var(--report-margin-header) ;
}

1 Answers1

0

yes , you can have negative properties in css and the right way to do that is to multiply the value by -1 using calc() function:

.class {
  margin-top: calc(var(--margin-md) * -1);
}
Zhivar Sourati
  • 503
  • 6
  • 9