Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

offset-path — positioning path

offset-path defines a geometric path for positioning an element. Setting a path alone neither starts an animation nor draws the path.

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

Syntax

offset-path: none | [ <offset-path> || <coord-box> ];
<offset-path> = <ray()> | <url> | <basic-shape>

offset-path defines a path for a transformable element. Its initial value, none, disables the offset transform; the property is not inherited. Repositioning does not recalculate neighboring elements' layout.

The path can be ray(), a url() reference to an SVG shape, or a <basic-shape> such as path() or circle(). An optional <coord-box> specifies the reference box; it defaults to border-box. A box alone means a path around its perimeter, including rounded corners.

offset-distance selects a point on the path; percentages refer to its length. offset-anchor selects the element's point placed on that path. offset-rotate defaults to auto, rotating the element to follow the path direction; 0deg disables that rotation. To produce movement, animate offset-distance, rather than merely defining a path.

Examples

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

Result

A blue 20 × 20 px square is centered at (120, 50) px inside a gray 240 × 100 px stage. The path is not drawn; nothing animates.

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