In SASS my Calculation looks like calc(50% - 375px);
But when it compiles the CSS output looks like that: calc(-325%)
, which is obviously not what I had in mind.
How can I force SASS to not do the maths (50% - 375px)
?
Thank you for your help!
In SASS my Calculation looks like calc(50% - 375px);
But when it compiles the CSS output looks like that: calc(-325%)
, which is obviously not what I had in mind.
How can I force SASS to not do the maths (50% - 375px)
?
Thank you for your help!
Use the SASS interpolation like this #{'calc(50% - 375px)'};
font-size: #{'min(max(2.4rem, 7vw), 4.5rem)'}
to stop SASS from applying it's own min() and max() functions. Though, according to the docs it should not sass-lang.com/documentation/syntax/…. Probably depends on the compiler? –
Karate Using the unquote function worked for me:
.selector {
height: unquote("calc(50% - 375px)");
}
We still ran into compile issue using escaped strings, but using capitalized Min
worked for us.
Ref: https://github.com/sass/sass/issues/2849#issuecomment-922070076
Use escaped string: ~"(50% - 375px)";
© 2022 - 2024 — McMap. All rights reserved.
height: calc(50% - #{375})
– Incriminate.test{ background: linear-gradient(to right, red 0px, white calc(50% - 375px), white calc(50% - 375px), white calc(50% + 375px), white calc(50% + 375px), red 100%);}
-> CSS:.test{ background: linear-gradient(to right, red 0px, white calc(-325%), ...);}
– Arenicolous