The transform property moves, rotates, scales, and skews elements visually — a core tool for modern UI effects and animations.
01
translate
Move X/Y.
02
rotate
Turn angles.
03
scale
Resize.
04
skew
Slant shape.
05
Combine
Stack functions.
06
2D / 3D
Depth effects.
Fundamentals
Introduction
The transform property in CSS is a powerful tool that allows web developers to apply 2D and 3D transformations to elements. This includes operations like translating (moving), rotating, scaling, and skewing elements.
The transform property is essential for creating dynamic and interactive designs without the need for complex animations or JavaScript.
Definition and Usage
Use transform for hover effects, card lifts, icon rotations, image galleries, and CSS transitions. Pair it with transition for smooth animated changes.
💡
Beginner Tip
Transforms change appearance only — the element keeps its original space in the layout. Use transform: translate() instead of changing top or left when you want smoother animations.
Foundation
📝 Syntax
The syntax for the transform property is straightforward and can include multiple transformation functions.
Here, transformation-function can be one or more of the following functions: translate(), rotate(), scale(), skew(), matrix(), perspective(), translateX(), translateY(), scaleX(), scaleY(), rotateX(), rotateY(), rotateZ(), and more.
Basic Example
transform.css
.box{transform:rotate(45deg);}
Syntax Rules
Separate multiple functions with spaces; they apply right to left in the transform list.
Use units like px, %, or deg inside functions.
none removes all transforms.
3D functions like rotateX() need perspective on a parent for visible depth.
The property is not inherited.
Related Properties
transform-origin — sets the pivot point for transforms
transition — animates transform changes smoothly
perspective — adds 3D depth to child transforms
will-change: transform — hints the browser to optimize animations
Defaults
🎯 Default Value
The default value of the transform property is none, which means no transformation is applied to the element.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Default value
none
Rotate 45 degrees
transform: rotate(45deg);
Move right and down
transform: translate(20px, 10px);
Scale to 150%
transform: scale(1.5);
Combine transforms
transform: translateY(-4px) scale(1.02);
Inherited
No
Reference
💎 Property Values
The transform property accepts none or one or more transform functions.
Value
Example
Description
none
transform: none;
No transformation is applied.
matrix(a, b, c, d, e, f)
transform: matrix(1, 0, 0, 1, 0, 0);
Defines a 2D transformation using a matrix of six values.
translate(tx, ty)
transform: translate(10px, 20px);
Moves the element by tx to the right and ty down.
translateX(tx)
transform: translateX(10px);
Moves the element horizontally.
translateY(ty)
transform: translateY(10px);
Moves the element vertically.
scale(sx, sy)
transform: scale(1.2, 0.8);
Scales the element horizontally and vertically.
scaleX(sx)
transform: scaleX(1.5);
Scales the element horizontally.
scaleY(sy)
transform: scaleY(0.5);
Scales the element vertically.
rotate(angle)
transform: rotate(45deg);
Rotates the element by the specified angle.
skew(ax, ay)
transform: skew(10deg, 5deg);
Skews the element horizontally and vertically.
skewX(ax)
transform: skewX(15deg);
Skews the element horizontally.
skewY(ay)
transform: skewY(10deg);
Skews the element vertically.
perspective(n)
transform: perspective(500px);
Defines a perspective view for 3D transformations.
translate()rotate()scale()skew()matrix()
Context
When to Use transform
transform is ideal for visual effects that should feel smooth and performant:
Hover interactions — Lift cards with translateY() and scale()
Icon animations — Rotate chevrons or loading spinners with rotate()
Image galleries — Zoom thumbnails on hover using scale()
CSS transitions — Animate transform changes instead of layout properties
Preview
👀 Live Preview
Three boxes with different transform functions applied:
rotate(45deg)
scale(1.25)
translate(12px, 8px)
Hands-On
Examples Gallery
In this example, we’ll apply a simple rotation to a div element.
📜 Basic Transforms
Start with single-function transforms on a simple box.
Example 1 — Rotate a box 45 degrees
In this example, we’ll apply a simple rotation to a div element.
The browser lays out the element in normal document flow first.
Layout
2
Transform functions apply
CSS applies translate, rotate, scale, or skew on a visual layer.
Transform
3
Painted result appears
Users see the transformed shape while layout space stays unchanged.
Visual
=
✅
Dynamic UI effects
Elements move, spin, and scale without rewriting HTML structure.
Compatibility
Browser Compatibility
The transform property is well-supported in most modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is recommended to test your transformations across different browsers to ensure a consistent user experience.
✓ Universal · All modern browsers
GPU-friendly effects
2D transforms work everywhere. 3D transforms are supported in all current major browsers with proper prefixes no longer required.
99%Browser support
Google Chrome36+ · Desktop & Mobile
Full support
Mozilla Firefox16+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera23+ · All versions
Full support
Testing tip
Test combined transforms and transform-origin in Safari and Firefox when building 3D card flips.
transform property99% supported
Bottom line:transform is safe for production UI effects in all modern browsers.
Wrap Up
Conclusion
The transform property is an essential tool for web developers looking to create visually engaging and interactive elements on their websites.
By leveraging various transformation functions, you can easily manipulate elements in both 2D and 3D space, adding a dynamic touch to your designs. Experiment with different transformations to see how this property can enhance the interactivity and visual appeal of your web projects.