Ordering Matters in CSS Independent Transforms
Firefox 72 pioneered “independent transforms,” letting developers skip the messy chore of repeating transforms just to tweak one value. Instead of layering them like this:
.el {
transform: translate(10px, 10px) scale(0.95) rotate(10deg);
}
…we can write shorthand like this:
.el {
rotate: 10deg;
scale: 0.95;
translate: 10px 10px;
}
This is a big usability win, since repeating or removing transforms manually is error-prone and tedious. But as Dan Wilson explains, a few nuances can bite.
Important details to remember:
- Independent transforms apply first. The
transformproperty runs afterward and stacks on top, which can get confusing. - All independent transforms share the same
transform-origin. - The
offset-*properties also move and rotate elements, but those occur after independent transforms and beforetransform.
- Claus Colloseus pointed out just how tricky the ordering is. For example,
rotate: 45deg; transform: rotate(-45deg);nets out to zero rotation since both apply sequentially. Buttranslate: 50px 0; rotate: 45deg; transform: translate(-50px, 0) rotate(-45deg);does not cancel out — the ordering makes the final result roughlytranslate(14.6447px, -35.3553px).



