Chain translate, rotate, scale and skew functions, see why their order changes the result, and copy a transform with identity values dropped.
Order matters and is not cosmetic. Rotating and then translating moves the element along its own rotated axis; translating and then rotating moves it and spins it in place.
.transformed {
transform: rotate(8deg) scale(1.05);
}CSS Transform Generator runs entirely on your device — nothing is uploaded.
You’re on the Free plan. Compare plans
Transform functions are applied right to left, and that single fact accounts for most of the time people lose to transforms. `translateX(100px) rotate(45deg)` moves the element and then rotates it where it landed. `rotate(45deg) translateX(100px)` rotates the coordinate system first, so the translation runs off at 45 degrees. Both are correct CSS and they do visibly different things, which is why the function list here is ordered and reorderable.
`transform-origin` is the other half of it. Rotation and scale happen around the origin, which defaults to the centre of the element — move it to a corner and the same rotation swings the element through a completely different arc. Any transform that is meant to look hinged needs the origin set.
Percentages in `translate()` resolve against the element's own size, not its parent's. That is what makes `translate(-50%, -50%)` the standard centring trick, and it is also why a percentage translate on an element whose size changes will move by a different amount than you expect.
The output drops identity values. A `scale(1)` or a `rotate(0deg)` does nothing but still forces the browser to keep a transform on the element, and leaving them in makes the declaration harder to read for no benefit. If every function is at its identity, the output is empty rather than a long string that means nothing.
Very much. They are applied right to left, so rotate then translate sends the element off at an angle, while translate then rotate moves it first and spins it in place. Reordering the list is a change in behaviour, not formatting.
The element's own width and height, not its container's. That is why pairing it with `top: 50%; left: 50%` centres an element of any size, and why it behaves unexpectedly on an element that changes size.
Because transform-origin is at the centre by default. If you want something to pivot like a door, set the origin to the edge it should hinge on.
Transform. A transform can be composited without recalculating layout, whereas animating top or left forces layout on every frame. For anything moving continuously, that is the difference between smooth and not.
Because every function in the list is at its identity value and the whole transform would do nothing. An empty output is the honest answer there rather than a long declaration with no effect.