Mister Told That Mister Told That - 1 month ago 21
Sass (Sass) Question

SASS percentage

Hello SOF guys and girls :)

Is there is any chance to get the result of this mathematical example, using Sass (I mean the final result in output.css file):


1000 - 20% = 800


For example, if I trying something like this:

$people: 1000
$dumb_by_trump: percentage(0.2)
$total_adequate: $people - $dumb_by_trump

us poll
hello_world: $total_adequate


Then I'll see in my output.css file the result as:

us poll {
hello_world: 980%; }


But we need to see "800" as a result. Is it possible? Thanks.

Answer

Multiply percentage by your constant value

$people: 1000
$dumb_by_trump: percentage(0.2)
$total_adequate: $people - $people*($dumb_by_trump/100%)

us pool
    hello_world: $total_adequate

Result

us pool {
  hello_world: 800;
}