CSS offset-anchor Property
Description
The offset-anchor property specifies the point within an element that is treated as the element’s anchor when the element is positioned along a motion path or by offset-based positioning. In practice, that means the anchor point is the part of the element that gets placed on the path or at the offset-position; shifting the anchor changes which pixel of the element is glued to the path and therefore changes the element’s apparent alignment and collision behavior with surrounding content. Because it chooses an internal reference point, offset-anchor is particularly useful for getting a visually natural placement of irregularly shaped or composite elements (for example, aligning a wheel or a pointer tip to a path rather than the element’s geometric center).
Using offset-anchor lets you fine-tune motion so that a specific visual feature follows the path exactly while the rest of the box is offset appropriately. It is commonly used together with the motion-path machinery — for example, offset-path to define the trajectory and offset-position or offset-rotate to control where and how the element moves and orients. Changing the anchor will shift where along that trajectory the element is drawn, so lessons learned when aligning icons, labels, or interactive handles to a path often start with adjusting the anchor before tweaking translations or rotations.
Although offset-anchor determines the anchor for path placement, it is distinct from the origin used by regular transforms: see transform-origin. In many motion scenarios the anchor is used as the reference point for path-based rotation behavior (so orientation around the path will appear to pivot around that anchor), while independent transforms on the element still use their own transform-origin. That distinction matters when you combine transform animations (scale/rotate) with path-following motion: the two origin definitions interact to produce the final visual result.
There are practical considerations when using offset-anchor: percentage-based anchors are interpreted relative to the element’s box, different writing modes or directionality can change the intuitive interpretation of corner-based anchors, and anchor changes during an animation can produce abrupt jumps if not animated smoothly. It also behaves differently depending on how the element is positioned in the document flow (see position for positioning models), so keep layout context in mind when choosing an anchor point for motion or offset effects.
Definition
- Initial value
- auto
- Applies to
- transformable elements
- Inherited
- no
- Computed value
- relative to the width and the height of the elements reference box
- Animatable
- a position
- JavaScript syntax
- object.style.offsetAnchor
Interactive Demo
Syntax
offset-anchor: auto | <position>
Values
- autooffset-anchor is given the same value as the element's transform-origin, unless offset-path is none, in which case it takes its value from offset-position.
- <position>A <position> defines an x/y coordinate, to place an item relative to the edges of an element's box. It can be defined using one to four values.
Example
Browser Support
The following information will show you the current browser support for the CSS offset-anchor property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported in some modern browsers, but not all.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
