The offset-anchor property controls which point inside an element sits on the motion path. It helps path animations look precise instead of floating above or below the route.
01
Anchor Point
Point on the element box.
02
Syntax
Use position values.
03
auto Default
Browser chooses anchor.
04
Keywords
top, center, bottom.
05
Percentages
Fine-tune placement.
06
Motion Path
Works with offset-path.
Fundamentals
Introduction
The offset-anchor property in CSS is part of the CSS Motion Path Module, which allows you to define an animation path for an element. The offset-anchor property specifies the position of the element relative to the path.
This property is particularly useful for creating animations along complex paths, as it allows you to control where the element is anchored on the path.
Definition and Usage
When an element moves along an offset-path, the browser must decide which part of the element touches the path line. That decision is made by offset-anchor.
For example, centering the anchor with 50% 50% makes a square ride smoothly on the path, while top left can make the same square appear to hang below the route.
💡
Beginner Tip
If your animated shape looks misaligned on the path, adjust offset-anchor before changing the path itself.
Foundation
📝 Syntax
The syntax for the offset-anchor property is:
syntax.css
element{offset-anchor:<position>;}
Here, <position> can be a set of values defining the anchor point relative to the element’s box.
Define a path with offset-path before adjusting the anchor.
Use keywords, percentages, or lengths like other CSS position values.
auto is the default and usually works for simple square elements.
Custom anchors are most helpful for non-square shapes or precise visual alignment.
Defaults
🎯 Default Value
The default value of the offset-anchor property is auto, which means the element’s position is automatically calculated based on the element’s size and the path.
In many beginner demos, auto and center look similar, but explicit values give you predictable control when the element is wider, taller, or irregularly shaped.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
auto
Applies to
Elements with a defined offset-path
Inherited
No
Animatable
Yes, as a position
Common use
Fine-tuning motion path animations
Reference
💎 Property Values
Value
Example
Description
auto
offset-anchor: auto;
Lets the browser determine the anchor automatically
Keywords
offset-anchor: top left;
Uses values such as top, center, bottom, and right
Percentages
offset-anchor: 50% 50%;
Places the anchor using horizontal and vertical percentages
Lengths
offset-anchor: 10px 20px;
Uses exact distances from the top-left of the element box
auto — defaultcenter — balanced ridetop left — corner anchor50% 50% — exact center
Preview
👀 Live Preview
These boxes follow the same curved path. Only the offset-anchor value changes:
center
top left
bottom center
Hands-On
Examples Gallery
Adjust the anchor point to control how an element sits on its motion path.
📌 Anchor Basics
Start with centered anchors before experimenting with corners and edges.
Example 1 — Centered Anchor on a Curved Path
In this example, a box follows a curved path with its anchor point set at the center of the box.
The bottom-center point rides on the path, so the marker appears to stand above the line.
Companion
Pair with offset-path and offset-distance
offset-anchor does not create motion by itself. You still need a path from offset-path and movement from offset-distance or an animation that changes distance along the route.
Respect reduced motion — Disable or simplify path animations inside prefers-reduced-motion media queries.
Keep motion decorative — Do not rely on path animation alone to communicate essential information.
Avoid distracting loops — Continuous motion can make nearby text harder to read.
Test visual clarity — A poor anchor choice can make motion harder to follow, especially for low-vision users.
🧠 How offset-anchor Works
1
A path is defined
offset-path creates the route the element will follow.
offset-path
2
You choose an anchor point
offset-anchor picks which part of the element sits on that path.
Anchor
3
Distance moves the element
As offset-distance changes, the chosen anchor travels along the route.
Motion
=
📌
Precise path alignment
The element follows the path from the exact point you selected inside its box.
Compatibility
Browser Compatibility
The offset-anchor property is a relatively new motion path feature. It is supported in modern versions of Chrome, Firefox, Safari, and Edge. Check compatibility and provide fallback animations for older browsers.
✓ Baseline · Modern browsers
Growing support in current browsers
Motion path properties including offset-anchor work in most up-to-date browser versions.
88%Modern browser support
Google Chrome116+ · Desktop & Mobile
Full support
Mozilla Firefox72+ · Desktop & Mobile
Full support
Apple Safari16+ · macOS & iOS
Full support
Microsoft Edge116+ · Chromium
Full support
Opera102+ · Modern versions
Full support
Fallback behavior
When unsupported, the element may remain static or ignore the custom anchor point.
💻
Internet ExplorerNo support · Use transform-based animation fallbacks
None
offset-anchor property88% supported
Bottom line: Use offset-anchor as progressive enhancement for decorative motion path effects.
Wrap Up
Conclusion
The offset-anchor property provides greater control over animations along a path by specifying the anchor point of the element. This can be particularly useful for fine-tuning animations and creating complex motion effects.
By understanding and using offset-anchor, you can enhance the visual appeal of your web projects and create more engaging user experiences.