The offset property belongs to the CSS Motion Path module. It lets you animate elements along curves, circles, and SVG paths instead of only moving them in straight lines with transform.
01
Motion Paths
Animate along a route.
02
Sub-properties
path, distance, anchor.
03
offset-path
Define the route.
04
offset-distance
Move along the path.
05
offset-rotate
Turn with the path.
06
@keyframes
Bring motion to life.
Fundamentals
Introduction
The offset property in CSS is used to control animations along a predefined path. It is part of the CSS Motion Path specification and is used with the @keyframes rule to define animations.
The offset property specifies the position of an element along a path defined by the offset-path property, allowing for more complex and dynamic animations.
Definition and Usage
In practice, developers usually work with the individual motion path properties rather than a single magic keyword. Together they describe where the path is, how far along it the element has traveled, which point of the element sits on the path, and how the element rotates while moving.
This is ideal for loader animations, decorative motion, icon paths, and playful UI effects that follow curves instead of simple horizontal or vertical movement.
💡
Beginner Tip
Start with a visible path like a circle or rectangle, then animate offset-distance from 0% to 100% before adding rotation or anchor adjustments.
Foundation
📝 Syntax
The offset property has several sub-properties that work together to define the animation’s behavior:
syntax.css
element{offset-path:path;offset-distance:distance;offset-anchor:position;offset-rotate:angle | auto | reverse;}
Basic Example
offset-circle.css
.animated-box{offset-path:path("M 150,200 A 100,100 0 1 1 149,200");animation:moveInCircle 5s linear infinite;}@keyframesmoveInCircle{from{offset-distance:0%;}to{offset-distance:100%;}}
Syntax Rules
Define a path first with offset-path.
Animate progress with offset-distance, usually through @keyframes.
Use offset-anchor to choose which point of the element sits on the path.
Use offset-rotate when the element should turn to follow the path direction.
Defaults
🎯 Default Value
The default values for the sub-properties are:
offset-path: none
offset-distance: 0
offset-anchor: auto
offset-rotate: auto
With these defaults, no motion path is active until you explicitly define a path and animate offset-distance.
The SVG-style path() function defines a circle, and the animation moves the element from 0% to 100% along that route.
Example 2 — Rectangle Path Animation
A small marker can travel around a rectangular border using a closed path and percentage-based distance.
rectangle-path.css
.marker{width:16px;height:16px;border-radius:999px;background:#dc2626;offset-path:path("M10 10 H 290 V 290 H 10 Z");animation:travelBorder 6s linear infinite;}@keyframestravelBorder{to{offset-distance:100%;}}
The quadratic curve creates a wave-like route. offset-anchor: 50% 50% keeps the dot centered on the path line.
Example 4 — Rotation with offset-rotate
Make a shape turn to follow the path direction using offset-rotate: auto.
offset-rotate.css
.arrow{width:24px;height:24px;background:#9333ea;offset-path:circle(80px at 120px 80px);offset-rotate:auto;animation:orbit 5s linear infinite;}@keyframesorbit{to{offset-distance:100%;}}
circle() defines a round orbit, and offset-rotate: auto aligns the element with the path tangent as it moves.
Companion
Related Motion Path Properties
The offset topic covers a family of properties. In real projects you will often see them split into dedicated pages such as offset-path, offset-distance, offset-anchor, and offset-rotate for finer control.
motion-path-set.css
.badge{offset-path:path("M 20,100 C 80,20 140,180 200,100");offset-distance:0%;offset-anchor:center;offset-rotate:auto;}
A11y
♿ Accessibility
Respect reduced motion — Wrap path animations in @media (prefers-reduced-motion: reduce) and provide a static fallback.
Do not rely on motion alone — Important status changes should also use text or icons.
Keep decorative motion subtle — Continuous looping paths can distract users with attention or vestibular sensitivity.
Test keyboard and screen reader flows — Motion should not block interaction with nearby controls.
🧠 How offset Works
1
You define a path
offset-path creates the route using SVG paths, circles, or other supported shapes.
offset-path
2
You move along the path
offset-distance sets how far the element has traveled, often animated with @keyframes.
Animation
3
You fine-tune anchor and rotation
offset-anchor and offset-rotate adjust how the element sits and turns on the path.
Refinement
=
🔄
Path-based motion
The element follows a custom route instead of a simple straight-line transform.
Compatibility
Browser Compatibility
The offset property and its associated sub-properties are relatively new. They are supported in modern versions of Chrome, Firefox, Safari, and Edge. Always check the latest browser support and consider fallbacks for unsupported browsers.
✓ Baseline · Modern browsers
Growing support for motion paths
Current Chrome, Firefox, Safari, and Edge versions support motion path animations in most common use cases.
89%Modern browser support
Google Chrome46+ · Desktop & Mobile
Full support
Mozilla Firefox72+ · Desktop & Mobile
Full support
Apple Safari15.4+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera33+ · Modern versions
Full support
Fallback behavior
When unsupported, elements remain static unless you provide a transform-based fallback animation.
💻
Internet ExplorerNo support · Use transform animations or JavaScript fallbacks
None
offset motion path properties89% supported
Bottom line: Motion paths are safe for modern decorative animation, but test carefully and respect reduced-motion preferences.
Wrap Up
Conclusion
The offset property in CSS provides a powerful tool for creating complex animations along predefined paths.
By controlling properties such as offset-path, offset-distance, offset-anchor, and offset-rotate, developers can create dynamic and engaging animations that enhance the user experience. Experiment with these properties to bring life and movement to your web projects.
Animate offset-distance with clear start and end values
Use offset-rotate: auto when direction matters
Respect prefers-reduced-motion for accessibility
Keep decorative motion subtle and purposeful
❌ Don’t
Confuse offset with top, right, bottom, or left
Assume every browser supports every path format equally
Overuse looping path animations on critical UI
Forget a static fallback for reduced-motion users
Make motion the only way to communicate important state
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about offset
Use these points when building path-based animations.
5
Core concepts
🔄01
Motion Path
Animates along a route.
Purpose
🛣02
offset-path
Defines the route.
Path
📏03
offset-distance
Controls progress.
Animation
📌04
offset-anchor
Sets anchor point.
Alignment
🔄05
offset-rotate
Turns with the path.
Direction
❓ Frequently Asked Questions
offset is part of the CSS Motion Path module. It helps animate an element along a predefined path using related properties such as offset-path and offset-distance.
No. Those inset properties move positioned elements in normal layout. offset is for motion-path animations along curves, circles, and SVG paths.
Common motion path properties include offset-path, offset-distance, offset-anchor, and offset-rotate.
Usually yes. Animating offset-distance from 0% to 100% is a common way to move an element along a path.
Modern Chrome, Firefox, Safari, and Edge support motion path properties, but you should test animations and provide fallbacks when needed.