Can you perform multiplication or division with unit-based values using calc() (such as 100%, 5px, etc)?
For instance, I wanted to try something like this:
width: calc(100% * (.7 - 120px / 100%));
Expecting it to result in something similar to (if 100% is equal to 500px):
width: calc(500px * (.7 - 120px / 500px));
width: calc(500px * (.7 - .24));
width: calc(500px * .46);
width: calc(230px);
However, upon experimenting, it seems that having a unit-based value as the denominator for division is not allowed.
I have also noticed that multiplying two values together like 5px * 10px
or 5px * 100%
is not possible.
I understand that it may not be feasible in all cases, but in my specific situation, I need to determine what percentage 120px represents of the total width, which I would then use in the rest of my calculation.
If anyone can suggest an alternative approach or solution, I would greatly appreciate it. I have tried brainstorming on my own but haven't found a viable solution yet.