Reputation: 1894
I am stuck here. I want to calculate 2/3 of 10rem like this:
$percentage : percentage(2/3); // 66.666667%
$width : 10rem;
$calculate : do magic: 66.666667% of 10rem;
img { max-height: calc( 100vh - $calculate ); }
I have been looking in the SASS documentation. I can only find some stuff about math function and not too much about percentage.
Upvotes: 0
Views: 551
Reputation: 935
The percentage(2/3)
function call appends a %
. You can not multiply that with a non-unitless value like 10rem
. Instead, calculate it directly like:
img {
max-height: calc(100vh - #{2/3 * 10rem});
}
The #{}
(interpolation) is needed to render the result of the calculation inside the Css calc()
expression.
Read more on...
Upvotes: 1