I want to set a width in percentage in scss via calculation, but it gives me errors..
Invalid CSS after \"...-width: (4/12)%\": expected expression (e
Another way:
$my_width: 4/12*100%;
div{
width: $my_width; // 33.33333%
}
Sass will output the value in %.
Have you tried the percentage function ?
$my_width: percentage(4/12);
div{
width: $my_width;
}
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.