[css-values] add function to convert numeric data types to <number> #6149
Labels
Closed as Question Answered
Used when the issue is more of a question than a problem, and it's been answered.
css-values-4
Current Work
The discussion in #4430 made me think, it would be nice to have a way to convert e.g. a
<length>
to a<number>
:font-variation-settings
is, from my perspective the best use case, as each keyword in it requires a<number>
and its often related to a<length>
. This could improve usage of variations, that don't have a sufficient or any higher level property, a lot, and make them accessible forcalc()
math.convert-to-number()
could be used in other cases, too, and would make it possible to relate properties in a way that is not currently possible without JavaScript. Another example is to control a pausedanimation
state by screen width using something like:Since it's possible to convert a number to a unit-value, like in
calc(1px * 16) /* -> 16px */
, it would make sense to have a way to do the inverse:calc(16px / 1pt) /* -> 1px * 16 / 1px * (4/3) -> 12 */
. But, I don't think this is possible now and it would probably make internal things much more complicated, hence my proposal to add a new function.The text was updated successfully, but these errors were encountered: