CSS offset-rotate Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Animation & Motion

What You’ll Learn

The offset-rotate property controls how an element turns while it travels along a motion path. It is what makes arrows, icons, and vehicles point in the direction they move.

01

Path Rotation

Turn with the route.

02

Syntax

auto, reverse, angle.

03

auto Default

Follow path direction.

04

Fixed Angle

Use deg or rad.

05

Curved Paths

Best on curves.

06

Motion Path Set

Works with offset-path.

Introduction

The offset-rotate property in CSS is used to specify the rotation of an element along the motion path defined by the offset-path property.

This property allows you to control the orientation of an element as it moves along the path, enabling complex animations and dynamic visual effects.

It is particularly useful for animating elements along curved paths where maintaining a specific orientation is crucial.

Definition and Usage

Without offset-rotate, an element may slide around a circle or curve while staying upright. With offset-rotate: auto, the element turns to follow the path tangent.

Use a fixed angle when you want the element to keep the same rotation no matter how the path bends.

💡
Beginner Tip

Try offset-rotate: auto first on a circular path. It is the easiest way to see the property in action.

📝 Syntax

The syntax for the offset-rotate property is as follows:

syntax.css
element {
  offset-rotate: auto | reverse | <angle> [<angle>]?;
}
  • auto — The element rotates along the path, aligning with the path direction.
  • reverse — Similar to auto, but rotated 180 degrees relative to the path direction.
  • <angle> — A fixed rotation such as 45deg, 0.5rad, or 100grad.

Basic Example

offset-rotate.css
.box {
  offset-path: circle(80px at 120px 80px);
  offset-rotate: auto;
  animation: orbit 5s linear infinite;
}

Syntax Rules

  • Define a path with offset-path before adjusting rotation.
  • Use auto when the element should point along the route.
  • Use a fixed angle when orientation should stay constant.
  • An optional second angle can add extra rotation in advanced cases.

🎯 Default Value

The default value of the offset-rotate property is auto, which means the element’s rotation aligns automatically with the direction of the motion path.

That makes it a strong default for directional icons and shapes moving along curved routes.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toElements with a defined offset-path
InheritedNo
AnimatableYes, as an angle
Common useDirectional motion along curved paths

💎 Property Values

ValueExampleDescription
autooffset-rotate: auto;Automatically aligns rotation with the path direction
reverseoffset-rotate: reverse;Follows the path direction but rotated 180 degrees
Angleoffset-rotate: 45deg;Uses a fixed rotation angle
Two anglesoffset-rotate: auto 45deg;Combines path alignment with an extra rotation offset
auto — follow path reverse — flip direction 0deg — stay upright 45deg — fixed tilt

👀 Live Preview

This square orbits a circle with offset-rotate: auto, so it turns to follow the path:

Examples Gallery

Compare automatic path rotation with fixed angles and reversed direction.

🔄 Rotation Basics

Start with auto when the element should point in its direction of travel.

Example 1 — Square with offset-rotate: auto

In this example, a square moves along a circular path and rotates automatically to follow the route.

auto-rotate.html
<style>
  .box {
    width: 50px;
    height: 50px;
    background-color: #2563eb;
    offset-path: path("M 100 0 A 100 100 0 1 1 100 -0.1");
    offset-rotate: auto;
    animation: move 5s infinite linear;
  }

  @keyframes move {
    to { offset-distance: 100%; }
  }
</style>

<div class="box"></div>
Try It Yourself

How It Works

auto keeps the square aligned with the tangent of the circular path as it moves.

Example 2 — Fixed 45deg Rotation

A fixed angle keeps the same tilt even when the path curves underneath the element.

fixed-angle.css
.marker {
  offset-path: path("M 10,80 Q 95,10 180,80 T 350,80");
  offset-rotate: 45deg;
  animation: follow 4s ease-in-out infinite alternate;
}

@keyframes follow {
  to { offset-distance: 100%; }
}
Try It Yourself

How It Works

The element keeps a constant 45deg rotation instead of turning with the curve.

🔀 Rotation Variations

Compare reversed path rotation and upright motion with 0deg.

Example 3 — reverse Direction

reverse follows the path but points the element in the opposite direction.

reverse-rotate.css
.car {
  offset-path: circle(70px at 140px 90px);
  offset-rotate: reverse;
  animation: orbit 4s linear infinite;
}

@keyframes orbit {
  to { offset-distance: 100%; }
}
Try It Yourself

How It Works

reverse is useful when the shape artwork faces the wrong way for auto.

Example 4 — Stay Upright with 0deg

Use 0deg when you want the element to slide along the path without turning.

zero-rotate.css
.label {
  offset-path: path("M 10,70 L 250,70");
  offset-rotate: 0deg;
  animation: travel 3s linear infinite alternate;
}

@keyframes travel {
  to { offset-distance: 100%; }
}
Try It Yourself

How It Works

The marker moves horizontally but keeps the same upright orientation throughout the animation.

Pair with offset-path and offset-distance

offset-rotate controls orientation only. You still need offset-path for the route and offset-distance to move along it.

motion-path-set.css
.arrow {
  offset-path: circle(80px at 120px 80px);
  offset-distance: 0%;
  offset-rotate: auto;
  animation: orbit 4s linear infinite;
}

♿ Accessibility

  • Respect reduced motion — Disable rotating path animations when prefers-reduced-motion: reduce is set.
  • Keep motion decorative — Do not rely on rotation alone to communicate important state.
  • Avoid disorienting spins — Fast rotating motion can be uncomfortable for some users.
  • Provide static fallbacks — Ensure content remains readable if motion path features fail.

🧠 How offset-rotate Works

1

The element follows a path

offset-path and offset-distance move the element along the route.

Motion
2

Rotation is applied

offset-rotate decides whether the element turns with the path or stays at a fixed angle.

Rotation
3

Orientation updates along the curve

With auto, the browser recalculates direction as the element travels around bends and corners.

Direction
=

Directional path animation

The element moves and points naturally along curved motion paths.

Browser Compatibility

The offset-rotate property is supported in most modern browsers, including Chrome, Firefox, Safari, and Edge. Test across browsers to ensure compatibility.

Baseline · Modern browsers

Good support in current browsers

Motion path rotation works reliably in up-to-date Chrome, Firefox, Safari, and Edge versions.

88% Modern browser support
Google Chrome 46+ · Desktop & Mobile
Full support
Mozilla Firefox 72+ · Desktop & Mobile
Full support
Apple Safari 15.4+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 33+ · Modern versions
Full support

Fallback behavior

When unsupported, the element may move without path-based rotation behavior.

💻
Internet Explorer No support · Use transform-based animation fallbacks
None
offset-rotate property 88% supported

Bottom line: Use offset-rotate as progressive enhancement for directional motion path effects.

Conclusion

The offset-rotate property provides fine-grained control over the orientation of elements as they move along a path.

This is especially useful for creating complex animations and ensuring that elements maintain a consistent orientation relative to their motion. Experiment with different values and combine them with other CSS properties to create dynamic and engaging animations on your web pages.

💡 Best Practices

✅ Do

  • Use auto for arrows and directional icons
  • Try reverse if the artwork faces backward
  • Use fixed angles for labels that should stay upright
  • Pair with offset-path and offset-distance
  • Respect reduced-motion preferences

❌ Don’t

  • Expect rotation without a defined motion path
  • Confuse offset-rotate with regular transform: rotate()
  • Use fast spinning motion for essential UI feedback
  • Assume every browser renders path rotation identically
  • Forget fallback behavior in unsupported browsers

Key Takeaways

Knowledge Unlocked

Five things to remember about offset-rotate

Use these points when controlling orientation on motion paths.

5
Core concepts
02

auto Default

Follows path direction.

Default
📝 03

Fixed Angle

deg, rad, grad.

Values
🛣 04

Curved Paths

Most visible effect.

Use case
📏 05

Motion Path Set

Needs offset-path.

Companion

❓ Frequently Asked Questions

offset-rotate controls how an element is rotated while it moves along a motion path defined by offset-path.
The default value is auto, which aligns the element with the direction of the path.
auto follows the path direction, while a fixed angle such as 45deg keeps a constant rotation regardless of the curve.
Yes. offset-rotate is meaningful when the element is positioned on a path with offset-path and offset-distance.
It is most useful for arrows, vehicles, or icons that should point in the direction they are traveling along a curved route.

Practice in the Live Editor

Open the HTML editor, define a motion path, and experiment with offset-rotate values.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful