Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Transforms, Transitions and Animations

The rotate property

Reference for the CSS rotate property: turn an element with its own property, using an angle or an axis and angle for 3D, independent from transform.

The rotate property turns an element by an angle. It does the same job as the rotate() functions in transform, but lives in its own property, so you can change or animate the rotation without touching any translation or scale.

By default the turn happens around the center of the element; change the pivot with transform-origin. Positive angles turn clockwise.

CSS
.icon {
  rotate: 45deg;
}

Try it

Rotate on hover

Syntax

CSS
rotate: none | <angle> | [ x | y | z | <number>{3} ] && <angle>;
  • Initial value: none
  • Applies to: transformable elements
  • Inherited: no
  • Animatable: yes
  • Computed value: none, or an axis and angle

Values

Value Description
<angle> A 2D rotation (around the z axis): 45deg, 0.25turn, 1.5rad, 100grad.
x, y, z with <angle> Rotate around that axis, like rotateX(); rotate: y 40deg flips toward or away from the viewer.
Three numbers with <angle> A custom axis vector, e.g. rotate: 1 1 0 45deg.
none No rotation.

Usage notes

  • Application order. translate is applied first, then rotate, then scale, then transform.
  • Animating more than a half-turn. Between 0deg and 360deg the browser interpolates the full angle, so rotate: 360deg is a spin. Animating with turn units reads clearly (1turn).
  • Interpolating from none treats it as a zero rotation, so it animates smoothly.
  • 3D needs perspective. An axis rotation looks flat without perspective on the element's parent.
  • Side effects are the same as for transform: stacking context, new containing block for fixed descendants, layout unchanged.
  • Accessibility. Constant spinning can trigger discomfort; stop it under prefers-reduced-motion.

Browser support

Individual transform properties are newer than transform. They work in current versions of the major browsers, but check a compatibility table when supporting older ones.