← Back to release summary

CSS typed arithmetic

Category
CSS
Type
Chromium catches up
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

Typed arithmetic allows to write expressions in CSS such a calc(10em / 1px) or calc(20% / 0.5em * 1px) which is useful for e.g. typography, as it allows to convert typed value into an untyped one and reuse it for number accepting properties or futher multiply the unitless value by some other type to e.g. cast from pixels to degrees.

Motivation

Currently, authors have to use tan(atan2(length_value, 1px)) trick to get rid of unit information. With typed arithmetic authors can just do (length_value / 1px) to get the unitless value.

Standards & signals

View on chromestatus.com