Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Transforms, Transitions and Animations

The offset-rotate property

Reference for the CSS offset-rotate property: auto, reverse and fixed angles control how an element turns while following an offset-path, with a live example.

When an element follows an offset-path, the offset-rotate property controls how it turns. With auto it points in the direction of travel, like a car following a road. With a fixed angle it keeps one orientation, like a drone that never rotates.

CSS
.arrow {
  offset-path: path("M 10 80 Q 150 0 290 80");
  offset-rotate: auto;
}

Try it

auto, reverse and a fixed angle

The blue arrow tilts up and then down along the arch. The pink one faces backwards, the green one always points right, and the amber one is turned a quarter turn from the path direction.

Syntax

CSS
offset-rotate: [ auto | reverse ] || <angle>

offset-rotate: auto;
offset-rotate: reverse;
offset-rotate: 45deg;
offset-rotate: auto 90deg;
  • Initial value: auto
  • Applies to: transformable elements
  • Inherited: no
  • Animatable: yes, as an angle (with a matching keyword)
  • Computed value: as specified, with the angle made absolute

Values

Value Description
auto The element's x axis follows the path direction, so it faces forward.
reverse Like auto but turned 180 degrees, so it faces backwards.
<angle> A fixed rotation, independent of the path direction, such as 0deg or 45deg.
auto <angle> / reverse <angle> The path direction (or its reverse) plus an extra angle.

Usage notes

  • Design the artwork pointing right. The element's positive x axis is its "front". An icon that points up needs offset-rotate: auto 90deg to face forward.
  • Fixed angles ignore the curve. Use 0deg when the element should stay upright, like a label on a moving marker.
  • It matters only with offset-path. Without a motion path, the property has no visible effect.
  • Combined with transform. Rotation from transform or rotate is applied on top of this one.
  • auto on sharp corners makes the element snap to the new direction at the corner. Rounded paths feel smoother.
  • Animating. Angles can be animated, but animating between auto and a plain angle does not interpolate. Keep the keyword the same.

Browser support

Supported together with motion paths in current versions of the major browsers. Older browsers ignore it and show the element unrotated.