0

I tried to calculate some css variables. But I've a problem with calc(percentage * percentage). It seem a problem with percentage multiplied by percentage.

  --test: 30%;
  --test2: 50%;
  background: hsl(
    10deg,
    40%,
    calc( 50% * var(--test) / var(test2) ) // doesn't work
  );

background: hsl(
    10deg,
    40%,
    calc( 50% * 1 ) // works
  );

  background: hsl(
    10deg,
    40%,
    calc( 50% * 100% ) // doesn't work
  );

  background: hsl(
    10deg,
    40%,
    calc( 50% * (100% / 100%) ) // doesn't work too
  );

Anyone can solve the problem with mixed unit? I cannot avoid using % in my css var.

Heyyy Marco
  • 633
  • 1
  • 12
  • 22

0 Answers0