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.

Syntaxcircle( <radial-size>? [ at <position> ]? )
Returns<basic-shape>
SupportChrome 37 · Firefox 54 · Safari 10.1
Speccss-shapes-1
img.avatar { clip-path: circle(50%); }
.figure { float: left; shape-outside: circle(); }
A circular crop, and text that wraps around a circular float.

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.

Syntaxellipse( <radial-size>? [ at <position> ]? )
Returns<basic-shape>
SupportChrome 37 · Firefox 54 · Safari 10.1
Speccss-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.

Syntaxinset( <length-percentage>{1,4} [ round <'border-radius'> ]? )
Returns<basic-shape>
SupportChrome 37 · Firefox 54 · Safari 10.1
Speccss-shapes-1
clip-path: inset(0 0 0 0 round 1rem);
Clip to the box with rounded corners; animate the insets for a reveal.

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().

Syntaxrect( [ <length-percentage> | auto ]{4} [ round <'border-radius'> ]? )
Returns<basic-shape>
SupportChrome 119 · Firefox 122 · Safari 17.2
Speccss-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().

Syntaxxywh( <length-percentage>{2} <length-percentage [0,∞]>{2} [ round <'border-radius'> ]? )
Returns<basic-shape>
SupportChrome 119 · Firefox 122 · Safari 17.2
Speccss-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.

Syntaxpolygon( <'fill-rule'>? [ round <length> ]? , [<length-percentage> <length-percentage>]# )
Returns<basic-shape>
Supportpolygon(): Chrome 37 · Firefox 54 · Safari 10.1
Rounded vertices (round): Chrome 150 · Firefox no · Safari no
Speccss-shapes-1
clip-path: polygon(50% 0, 100% 100%, 0 100%);
A triangle.

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.

Syntaxpath( <'fill-rule'>? , <string> )
Returns<basic-shape>
SupportIn clip-path: Chrome 88 · Firefox 72 · Safari 13.1
In offset-path: Chrome 56 · Firefox 72 · Safari 16
In the d property: Chrome 52 · Firefox 97 · Safari no
Speccss-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.

Syntaxshape( <'fill-rule'>? from <position> , <shape-command># )
Returns<basic-shape>
SupportChrome 135 · Firefox 148 · Safari 18.4
Speccss-shapes-1
CommandDraws
move to / move byStarts a new sub-path at a point, without drawing.
line to / line byA straight line to a point.
hline / vlineA horizontal or vertical line.
curveA quadratic or cubic Bézier curve, with with control points.
smoothA Bézier curve whose first control point mirrors the previous curve's.
arcAn elliptical arc to a point.
closeA 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);
A banner with a pointed bottom whose point stays 2rem tall at any size.

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.

Syntaxray( <angle> && <ray-size>? && contain? && [at <position>]? )
ReturnsAn offset path, for offset-path
Supportray(): Chrome 116 · Firefox 122 · Safari 16
Starting position (at): Chrome 116 · Firefox 122 · Safari 17.2
Specmotion-1
offset-path: ray(45deg closest-side);
offset-distance: 100%;
Move an element along a 45-degree ray to its far end.

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.

Syntaxsuperellipse(<number> | infinity | -infinity)
Returns<corner-shape-value>
SupportChrome 139 · Firefox no · Safari no
Speccss-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.

Syntaxurl( <string> <url-modifier>* ) | <url-token>
Returns<url>
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-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:

ModifierEffectSupport
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));
A relative image, and a cross-origin mask fetched with CORS.

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.

Syntaximage-set( <image-set-option># )
Returns<image>
SupportChrome 113 · Firefox 89 · Safari 17
Speccss-images-4
background-image: image-set(
  "hero.avif" type("image/avif"),
  "hero@2x.jpg" 2x,
  "hero.jpg" 1x
);
AVIF where supported, otherwise a JPEG matched to the screen density.

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.

Syntaxcross-fade( <cf-image># )
Returns<image>
SupportChrome no · Firefox no · Safari 10
Speccss-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.

Syntaxpaint( <ident>, <declaration-value>? )
Returns<image>
SupportChrome 65 · Firefox no · Safari no
Speccss-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.

Syntaxfilter( [ <image> | <string> ], <filter-value-list> )
Returns<image>
SupportChrome no · Firefox no · Safari 9.1
Specfilter-effects-1
background-image: filter(url("photo.jpg"), blur(4px) grayscale(1));
A blurred, greyscale background image behind sharp text.