CSS Transform

The CSS transform property visually changes an element by moving, rotating, scaling, or skewing it, without affecting the layout of surrounding elements. It is widely used for animations and effects.

Web

Common transform functions are translate() to move, rotate() to turn, scale() to resize, and skew() to slant. You can combine several in one declaration.

Because transforms are hardware-accelerated and don't trigger layout recalculation, they are a performance-friendly way to animate movement and scaling.

Examples

CSS

.card:hover {
  transform: scale(1.05) rotate(2deg);
}

Output:

Slightly enlarges and tilts the card when the mouse hovers over it.

Learn it in a lesson

See also

Back to the Dictionary