path() CSS Function
The path() function defines a shape using SVG path data, such as path("M0 0 L100 0 L50 80 Z"), used by clip-path and offset-path.
Description
The path() CSS function defines a shape using an SVG path data string, the same d attribute syntax used by the SVG <path> element. It is a <basic-shape>, so it can be used with clip-path to cut an element into any outline, with offset-path to move an element along a curved route, and with shape-outside in browsers that support it there.
The path string is made of commands followed by coordinates: M moves to a point, L draws a straight line, H and V draw horizontal and vertical lines, C and S draw cubic Bézier curves, Q and T draw quadratic curves, A draws an arc, and Z closes the shape. Uppercase commands use absolute coordinates and lowercase commands are relative to the previous point. An optional first argument, nonzero or evenodd, sets the fill rule that decides which areas count as inside the shape.
The coordinates are unitless numbers treated as pixels, so a path() shape does not scale with the element. For responsive shapes that can use percentages, calc() and other CSS units, use the newer shape() function, or polygon() for shapes made only of straight lines.
/* Heart-shaped clip */
.heart {
width: 200px;
height: 180px;
clip-path: path("M100,170 C40,120 0,80 0,45 A45,45 0 0 1 100,30 A45,45 0 0 1 200,45 C200,80 160,120 100,170 Z");
}
/* Move an element along a curve */
.dot {
offset-path: path("M10,80 C40,10 65,10 95,80 S150,150 180,80");
animation: move 3s ease-in-out infinite alternate;
}
@keyframes move {
to { offset-distance: 100%; }
}
Interactive Demo

Syntax
path() = path( <'fill-rule'>? , <string> )
Values
- <'fill-rule'>The filling rule for the interior of the path. Possible values are nonzero or evenodd. The default value is nonzero.
- <string>The string is a data string for defining an SVG path.
Example
Browser Support
The following information will show you the current browser support for the CSS path() function. Hover over a browser icon to see the version that first introduced support for this CSS function.
Desktop





Tablets & Mobile





