Shapes & images
The <basic-shape> functions that clip-path, shape-outside and offset-path use to describe a region or a path, the motion path ray() and the corner curve superellipse(), then url() and the functions that produce an <image>. Gradients, which are images too, have their own page under Gradients; the properties that take shapes are under Filters, effects & masking.
Basic shapes
circle()
A circle with a radius and an optional centre given with at <position>. The radius is a length, a percentage, or closest-side (the default) or farthest-side. Percentages resolve against the diagonal of the reference box divided by √2.
| Syntax | circle( <radial-size>? [ at <position> ]? ) |
|---|---|
| Returns | <basic-shape> |
| Support | Chrome 37 · Firefox 54 · Safari 10.1 |
| Spec | css-shapes-1 |
img.avatar { clip-path: circle(50%); }
.figure { float: left; shape-outside: circle(); }
ellipse()
An ellipse with two radii, horizontal then vertical, and an optional centre. Each radius is a length, a percentage of the matching dimension of the reference box, or closest-side or farthest-side.
| Syntax | ellipse( <radial-size>? [ at <position> ]? ) |
|---|---|
| Returns | <basic-shape> |
| Support | Chrome 37 · Firefox 54 · Safari 10.1 |
| Spec | css-shapes-1 |
inset()
A rectangle given by how far each edge is inset from the reference box, with one to four values in the same order as margin. An optional round followed by border-radius values rounds its corners.
| Syntax | inset( <length-percentage>{1,4} [ round <'border-radius'> ]? ) |
|---|---|
| Returns | <basic-shape> |
| Support | Chrome 37 · Firefox 54 · Safari 10.1 |
| Spec | css-shapes-1 |
clip-path: inset(0 0 0 0 round 1rem);
rect()
A rectangle given by the positions of its top, right, bottom and left edges, each measured from the top or left edge of the reference box. auto puts that edge on the box's own edge. It can take round corners like inset().
| Syntax | rect( [ <length-percentage> | auto ]{4} [ round <'border-radius'> ]? ) |
|---|---|
| Returns | <basic-shape> |
| Support | Chrome 119 · Firefox 122 · Safari 17.2 |
| Spec | css-shapes-1 |
xywh()
A rectangle given by the x and y position of its top-left corner, then its width and height. It can take round corners like inset().
| Syntax | xywh( <length-percentage>{2} <length-percentage [0,∞]>{2} [ round <'border-radius'> ]? ) |
|---|---|
| Returns | <basic-shape> |
| Support | Chrome 119 · Firefox 122 · Safari 17.2 |
| Spec | css-shapes-1 |
polygon()
A polygon from a comma-separated list of x y vertex positions. The optional fill rule, nonzero (the default) or evenodd, decides what counts as inside when edges cross.
| Syntax | polygon( <'fill-rule'>? [ round <length> ]? , [<length-percentage> <length-percentage>]# ) |
|---|---|
| Returns | <basic-shape> |
| Support | polygon(): Chrome 37 · Firefox 54 · Safari 10.1Rounded vertices ( round): Chrome 150 · Firefox no · Safari no |
| Spec | css-shapes-1 |
clip-path: polygon(50% 0, 100% 100%, 0 100%);
path()
A shape or path from an SVG path data string, the same syntax as the d attribute of an SVG <path>. The coordinates are in pixels, so the shape does not scale with the box; use shape() for a responsive path.
| Syntax | path( <'fill-rule'>? , <string> ) |
|---|---|
| Returns | <basic-shape> |
| Support | In clip-path: Chrome 88 · Firefox 72 · Safari 13.1In offset-path: Chrome 56 · Firefox 72 · Safari 16In the d property: Chrome 52 · Firefox 97 · Safari no |
| Spec | css-shapes-1 |
shape()
A path written as CSS drawing commands instead of an SVG string, so its coordinates can be percentages, calc() expressions and custom properties, and it scales with the box. It starts from a point, then lists commands separated by commas.
| Syntax | shape( <'fill-rule'>? from <position> , <shape-command># ) |
|---|---|
| Returns | <basic-shape> |
| Support | Chrome 135 · Firefox 148 · Safari 18.4 |
| Spec | css-shapes-1 |
| Command | Draws |
|---|---|
move to / move by | Starts a new sub-path at a point, without drawing. |
line to / line by | A straight line to a point. |
hline / vline | A horizontal or vertical line. |
curve | A quadratic or cubic Bézier curve, with with control points. |
smooth | A Bézier curve whose first control point mirrors the previous curve's. |
arc | An elliptical arc to a point. |
close | A line back to the start of the sub-path. |
The to forms take absolute positions in the reference box; the by forms are relative to the current point.
clip-path: shape(from 0 0, hline to 100%, vline to calc(100% - 2rem), line to 50% 100%, line to 0 calc(100% - 2rem), close);
Motion paths & corners
ray()
An offset-path that is a straight line from the element's offset position at a given angle. The size sets how long the ray is (closest-side by default, or farthest-side, closest-corner, farthest-corner or sides), contain shortens it so the element stays inside its containing block, and at <position> sets where it starts.
| Syntax | ray( <angle> && <ray-size>? && contain? && [at <position>]? ) |
|---|---|
| Returns | An offset path, for offset-path |
| Support | ray(): Chrome 116 · Firefox 122 · Safari 16Starting position ( at): Chrome 116 · Firefox 122 · Safari 17.2 |
| Spec | motion-1 |
offset-path: ray(45deg closest-side);
offset-distance: 100%;
superellipse()
A corner curve for corner-shape, set by one number. 1 is a normal round corner, 2 a squircle, 0 a straight bevel, -1 a scoop, infinity a square corner and -infinity a notch; values in between blend smoothly, so the corner shape can be animated.
| Syntax | superellipse(<number> | infinity | -infinity) |
|---|---|
| Returns | <corner-shape-value> |
| Support | Chrome 139 · Firefox no · Safari no |
| Spec | css-borders-4 |
URLs & images
url()
A reference to a resource such as an image, font or SVG filter. A relative URL resolves against the stylesheet it appears in, not the page. The URL can be quoted or unquoted; only the quoted form can be followed by request modifiers.
| Syntax | url( <string> <url-modifier>* ) | <url-token> |
|---|---|
| Returns | <url> |
| Support | Chrome 1 · Firefox 1 · Safari 1 |
| Spec | css-values-4 |
<url-token> is the unquoted form, url(image.png), in which spaces, quotes and brackets must be escaped. The request modifiers change how the browser fetches the resource:
| Modifier | Effect | Support |
|---|---|---|
cross-origin(anonymous | use-credentials) | Makes a CORS request, with or without credentials, like the HTML crossorigin attribute. | Chrome 150 · Firefox no · Safari 26.2 |
integrity(<string>) | A subresource integrity hash the response must match, like the HTML integrity attribute. | Chrome 150 · Firefox no · Safari no |
referrer-policy(no-referrer | no-referrer-when-downgrade | same-origin | origin | strict-origin | origin-when-cross-origin | strict-origin-when-cross-origin | unsafe-url) | The referrer policy for the request, like the HTML referrerpolicy attribute. | Chrome 150 · Firefox no · Safari 26.2 |
background-image: url("hero.avif");
mask-image: url("https://cdn.example.com/mask.svg" cross-origin(anonymous));
image-set()
A list of alternative images from which the browser picks the best one for the screen's resolution and the formats it supports, like srcset on an <img>. Each option is an image with an optional resolution (1x, 2x, 192dpi) and an optional type() giving its MIME type.
| Syntax | image-set( <image-set-option># ) |
|---|---|
| Returns | <image> |
| Support | Chrome 113 · Firefox 89 · Safari 17 |
| Spec | css-images-4 |
background-image: image-set(
"hero.avif" type("image/avif"),
"hero@2x.jpg" 2x,
"hero.jpg" 1x
);
cross-fade()
An image that blends two images together, each weighted by a percentage. Safari supports only the original form: two images followed by one percentage, cross-fade(url(a.png), url(b.png), 50%), not the comma-separated list in the current syntax.
| Syntax | cross-fade( <cf-image># ) |
|---|---|
| Returns | <image> |
| Support | Chrome no · Firefox no · Safari 10 |
| Spec | css-images-4 |
paint()
An image drawn by a paint worklet, JavaScript registered with CSS.paintWorklet.addModule() under the given name. Any further arguments are passed to the worklet's paint function. The image is redrawn when the box size or the custom properties it reads change.
| Syntax | paint( <ident>, <declaration-value>? ) |
|---|---|
| Returns | <image> |
| Support | Chrome 65 · Firefox no · Safari no |
| Spec | css-paint-api-1 |
filter()
An image with filter functions applied to it, so you can blur or recolour just a background image rather than the whole element.
| Syntax | filter( [ <image> | <string> ], <filter-value-list> ) |
|---|---|
| Returns | <image> |
| Support | Chrome no · Firefox no · Safari 9.1 |
| Spec | filter-effects-1 |
background-image: filter(url("photo.jpg"), blur(4px) grayscale(1));