CSS offset-distance egenskap

Definition and usage

offset-distance The attribute is used to set the distance between the element and the path defined by offset-path Distance between the path start points defined by the attribute.

Example

The <img> element is placed at a position 33% from the start of the defined path.

img {
  offset-path: path('M 50 80 C 150 -20 250 180 350 80');
  offset-distance: 33%;
}

Try it yourself

CSS Syntax

offset-distance: auto|length|initial|inherit;

Attribute value

Value Description
0 The element is placed at the start of the path. Default value.
length

Specify the distance between the element and the path start using fixed units (such as px, pt, cm, etc.).

Negative values are not allowed. See:CSS enheter.

% Specifies a percentage distance relative to the path length.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: 0
Inheritance: No
Animation creation: Supported. See:Animation-related properties.
Version: CSS3
JavaScript Syntax: object.style.offsetDistance="200px"

Browser Support

The numbers in the table represent the first browser version to fully support this attribute.

Chrome Edge Firefox Safari Opera
55 79 72 16 42

Relaterade sidor

Lär dig:SVG-sökväg

Lär dig:CSS-animering

Referens:CSS offset egenskap

Referens:CSS offset-anchor egenskap

Referens:CSS offset-path egenskap

Referens:CSS offset-position egenskap

Referens:CSS offset-rotate egenskap