Is there a way to remove units from calc function in CSS

I am currently using the following rule:

margin-left: calc(((100vw - 624px) / 144) * 5);

With a viewport width of 1200px this gives a value of 20px. However, I want to get a result of 20%. Ideally, this would mean a change in the multiplication factor “5” from a whole to “5%”. But for this I need to remove units from the rest of the calculation, so the calculation will process 4 * 5%, not 4px * 5.

In SASS I can divide by 1px, but in calc you can only divide by a number, not a single value.

Is there a way to remove units from part of calc function?

+4
source share
1 answer

strip-unit SASS CSS, CSS3 .

0

Source: https://habr.com/ru/post/1659816/


All Articles