I try to construct an expression for a variable line height depending on the width using calc()
. The result should be a fraction without units. Is it possible?
To be more precise, I would like to get something like line-height: 2;
when 200rem / width < 2
and line-height: 1;
when 200rem / width > 2
So, the above 200rem / width
should somehow evaluate to a plain fraction. It may be using 100wh
or similar. Please note that we don't know the width, we must use a variable!
For example the following:
li > a {
line-height: calc(22px + (28 - 22) * ((100vw - 480px) / (3840 - 480)));
}
could do the job, but it evaluates to some pixels minus some width units instead of plain fraction without any units as I need.