Menu

CSS Typed OM is Baseline now: stop gluing "px" onto strings
📰

CSS Typed OM is Baseline now: stop gluing "px" onto strings

DEV Community: css·Pouya Moradzad·3 days ago
#FU6diXVh
#devtocss#devto#dev#unit#value
Long article (706 words) — no AI summary yet.
Reading 0:00
15s threshold

Firefox 161 shipped on November 24, 2026 with the CSS Typed Object Model turned on. Chrome has had it since version 66 and Safari since 16.4, so Firefox was the last engine missing, and the feature is now Baseline newly available.

If you have ever written el.style.width = size + "px" and then parseFloat(getComputedStyle(el).width) to read it back, this is the API that replaces that habit.

The short version

The old CSSOM speaks strings. The Typed OM speaks objects:

// Old: build a string, hope the unit is right el . style . transform = `rotate(${deg}deg) scale(${s})` ;

// Typed OM: values and units are separate el . attributeStyleMap . set ( "transform" , new CSSTransformValue ( [ new CSSRotate ( CSS . deg ( deg ) ) , new CSSScale ( CSS . number ( s ) , CSS . number ( s ) ) , ] ) ) ;

Enter fullscreen mode

Exit fullscreen mode

CSS.deg() , CSS.px() , CSS.rem() and friends are factory functions that return a CSSUnitValue with a value and a unit . Reading works the same way:

const t = el .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.