# rotate

> The `rotate` CSS property allows rotating an element around a fixed point.

## How do I use the CSS rotate property without overwriting transform?

The property that applies a 2D or 3D rotation to an element around a fixed point. It doesn't overwrite the `transform` property, as it directly sets the rotation without affecting other transform functions. This property is useful for rotating elements to achieve various visual effects.

- Topic: Transformations
- Type: property
- Browser support: Chrome 104+, Chrome Android 104+, Edge 104+, Firefox 72+, Firefox Android 79+, Safari 14.1+, Safari iOS 14.5+

## Example

Wrong:

```css
.badge {
  transform: translate(-50%, -50%);
}
.badge:hover {
  transform: rotate(10deg);
}
```

Right:

```css
.badge {
  transform: translate(-50%, -50%);
}
.badge:hover {
  rotate: 10deg;
}
```

The `rotate` property adds rotation on top of the existing `transform`, so the badge stays in place.

## Common mistakes

- Writing `rotate: 45` without a unit, so it is ignored.
- Expecting `rotate` to apply after `transform`, when it is applied before it.

## Key points

- Rotation that must combine with an existing `transform` uses the `rotate` property instead of a second `transform`.
- 3D axis rotation is written as `rotate: x 45deg` or `rotate: 1 1 0 45deg`, without commas.

## Interview questions

### Can I rotate around the X or Y axis with the rotate property?

Yes. Put the axis before the angle, like `rotate: y 180deg`, or give a vector such as `rotate: 1 0 0 45deg`.

### Can I animate rotate and transform separately?

Yes. They are separate properties, so each can have its own transition or animation.

## Related cards

- [rotate()](https://wonderium.dev/css/rotate.md)
- [translate](https://wonderium.dev/css/translate-property.md)
- [scale](https://wonderium.dev/css/scale-property.md)
- [transform](https://wonderium.dev/css/transform.md)
- [transition](https://wonderium.dev/css/transition.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/rotate-property
- Last updated: 2026-11-25
