0

I have the following SASS code:

margin: #{-5/16}rem

I get with this code:

margin: -5/16rem

I want this output:

margin: -0.3125rem

I also tried this:

margin: (-5/16)rem

but this results in:

margin: -0.3125 rem <- notice the space between number and unit

2 Answers2

1

I tried combining both your notations and it seems to properly work (Sass v3.4.25):

margin: #{(-5/16)}rem; /* margin: -0.3125rem; */

Sassmeister demo

Fabrizio Calderan
  • 120,726
  • 26
  • 164
  • 177
0

Sass can directly do math with units, so the correct syntax to get your desired result is:

margin: (-5rem/16)
Marcel Greter
  • 275
  • 1
  • 10