- Home
- /
- CSS 2D Transform
CSS Tutorial
Introduction
CSS Properties
CSS Designing
CSS Advance Topics
CSS FAQs
- Home
- /
- CSS 2D Transform
CSS 2D Transform
The transform
property in CSS allows you to visually manipulate elements in two-dimensional space using functions like translate
, rotate
, scale
, and skew
. These transformations are applied along the X and Y axes (horizontal and vertical).
Translate – Move an Element
The translate(x, y)
function moves an element from its original position.
transform: translate(50px, 30px);
Moves 50px to the right and 30px down.
Negative values move left or up.
Example:
Translate Example – Learn With Arshyan
Moved

Rotate – Turn the Element
The rotate(deg)
function rotates an element clockwise by default.
transform: rotate(20deg);
Use a negative value for counterclockwise rotation.
Example:
Rotated

Scale – Resize the Element
The scale(x, y)
function enlarges or shrinks the element horizontally and vertically.
transform: scale(1.5, 0.8);
Example:
Scaled

Note: This transformation can stretch or squash the content if the scale values aren’t equal.
Skew – Slant the Element
The skew(x-angle, y-angle)
function slants an element horizontally or vertically.
transform: skew(15deg, 5deg);
Example:
Skewed

You can also skew on a single axis:
transform: skewX(15deg);
transform: skewY(-10deg);
Multiple Transforms
You can combine multiple transforms in one line:
transform: rotate(10deg) scale(1.2) translate(20px, 10px);
Transformations are applied in order from left to right.
Summary Table
Function | Purpose | Syntax Example |
---|---|---|
translate(x, y) | Moves element | translate(30px, 10px) |
rotate(deg) | Rotates clockwise/counterclockwise | rotate(-25deg) |
scale(x, y) | Resizes element | scale(1.2, 0.9) |
skew(x, y) | Slants horizontally or vertically | skew(10deg, 5deg) |
Learn With Arshyan Tip:
2D transforms are powerful for building animations, hover effects, and dynamic layouts. Try experimenting with these to bring your design to life.