Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

offset — motion path shorthand

The offset property combines a path definition, position along it, rotation, and the element’s anchor point.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

offset: [ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> || <'offset-rotate'> ]? ]? ]! [ / <'offset-anchor'> ]?;

offset sets five properties: offset-position (path starting position), offset-path (path), offset-distance (distance along it), offset-rotate (rotation), and offset-anchor (the element point aligned to the path). It applies to transformable elements; it does not start an animation itself.

Write the anchor after /. Percentage distances refer to path length. For rotation, auto follows the path direction, whereas 0deg disables that rotation. Omitted components reset to their initial values: respectively normal, none, 0, auto, auto. A later shorthand can therefore overwrite earlier longhand settings.

Examples

<!doctype html>
<meta charset="utf-8">
<title>offset</title>
<style>
  .stage {
    position: relative;
    width: 240px;
    height: 100px;
    background: #eee;
  }
  .dot {
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    background: #164dcc;
    offset: path("M 20 50 L 220 50") 50% 0deg / center;
  }
</style>
<div class="stage"><div class="dot"></div></div>

Result

A stationary blue 20px square centered at (120px, 50px) relative to the stage; its top-left corner is at (110px, 40px).

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources