Calculate a percent with SCSS/SASS

Solution 1:

Have you tried the percentage function ?

$my_width: percentage(4/12);
div{
width: $my_width;
}

Solution 2:

Another way:

$my_width: 4/12*100%;

div{
width: $my_width; // 33.33333%
}

Sass will output the value in %.

Solution 3:

I was able to make it work this way:

div{
   width: (4/12)* 1%;
   }

This way you don't need to use any special function.