CSS offset-distance egenskab

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 units.

% Specifies the 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 Production: Supported. See:Animation-related properties.
Version: CSS3
JavaScript Syntax: object.style.offsetDistance="200px"

Browser Support

The numbers in the table represent the browser version that first fully supports this property.

Chrome Edge Firefox Safari Opera
55 79 72 16 42

Relaterede sider

Tutorial:SVG path

Tutorial:CSS animation

Referencer:CSS offset egenskab

Referencer:CSS offset-anchor egenskab

Referencer:CSS offset-path egenskab

Referencer:CSS offset-position egenskab

Referencer:CSS offset-rotate egenskab