QuickDevGuide

Home › CSS

Transforms & 3D — CSS

The transform property moves, rotates, scales and skews elements without affecting layout — surrounding elements do not move. Because the browser can run transforms on the GPU, they are the preferred way to animate. 2D transform functions Function Example Effect translate(x, y) translate(20px, -50%) Move scale(x, y) scale(1.1) Resize rotate(angle) rotate(45deg) Rotate skew(x, y) skew(10deg) Slant Transforms are applied right to left, so translate(100px) rotate(45deg) rotates first, then moves. transform-origin sets the pivot point (default: centre). Individual transform properties Modern CSS also supports standalone translate, rotate and scale properties, which can be animated independently. 3D Add perspective on the parent to give depth, then use rotateX, rotateY and translateZ…

Key Takeaways