Candidate Recommendation Draft · css-shapes

CSS Shapes

5 properties, 8 functions, 1 type defined by this specification, 12 of them known to at least one browser (the others are badged Not in any browser yet).

Each feature in detail

shape-image-threshold

Property Baseline: widely availablesince July 2022

MDN The shape-image-threshold CSS property sets the alpha channel threshold used to extract the shape using an image as the value for shape-outside.

Live preview Example from MDN
.example-container {
  text-align: left;
  padding: 20px;
}

#example-element {
  float: left;
  width: 150px;
  height: 150px;
  margin: 20px;
  background-image: linear-gradient(
    50deg,
    rgb(77 26 103),
    transparent 80%,
    transparent
  );
}

Syntax

<opacity-value>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
0
Applies to
floats
Inherited
no
Percentages
n/a
Computed value
specified number, clamped to the range [0,1]
Canonical order
per grammar
Animation type
by computed value

Browser support

First browser version supporting shape-image-threshold
Chrome 37
Edge 79
Firefox 62
Safari 10.1
Chrome Android 37
Safari iOS 10.3

First version with support, from MDN browser-compat-data.

shape-inside

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

auto | outside-shape | [ <basic-shape> || shape-box ] | <image> | display

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
auto
Applies to
block-level elements
Inherited
no
Percentages
n/a
Computed value
computed lengths for <basic-shape>, the absolute URL for <url>, otherwise as specified
Canonical order
per grammar
Animation type
as defined for <basic-shape>, otherwise discrete

shape-margin

Property Baseline: widely availablesince July 2022

MDN The shape-margin CSS property sets a margin for a CSS shape created using shape-outside.

Live preview Example from MDN
.example-container {
  text-align: left;
  padding: 20px;
}

#example-element {
  float: left;
  margin: 20px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background-color: rebeccapurple;
  shape-outside: circle(50%);
}

Syntax

<length-percentage [0,∞]>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
0
Applies to
floats and initial letter boxes
Inherited
no
Percentages
refer to the inline size of the containing block
Computed value
computed <length-percentage> value
Canonical order
per grammar
Animation type
by computed value

Browser support

First browser version supporting shape-margin
Chrome 37
Edge 79
Firefox 62
Safari 10.1
Chrome Android 37
Safari iOS 10.3

First version with support, from MDN browser-compat-data.

shape-outside

Property Baseline: widely availablesince July 2022

MDN The shape-outside CSS property defines a shape—which may be non-rectangular—around which adjacent inline content should wrap. By default, inline content wraps around its margin box; shape-outside provides a way to customize this wrapping, making it possible to wrap text around complex objects rather than rectangular boxes.

Live preview Example from MDN
.example-container {
  text-align: left;
  padding: 20px;
}

#example-element {
  float: left;
  width: 150px;
  margin: 20px;
}

Syntax

none | [ <basic-shape> || <shape-box> ] | <image>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
none
Applies to
floats and initial letter boxes
Inherited
no
Percentages
n/a
Computed value
as defined for <basic-shape> (with <shape-box> following, if supplied); else the computed <image>; else the keyword as specified
Canonical order
per grammar
Animation type
as defined for <basic-shape>, otherwise discrete

Browser support

First browser version supporting shape-outside
Chrome 37
Edge 79
Firefox 62
Safari 10.1
Chrome Android 37
Safari iOS 10.3

First version with support, from MDN browser-compat-data.

shape-padding

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<length-percentage [0,∞]>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
0
Applies to
block-level elements
Inherited
no
Percentages
refer to the inline size of the containing block
Computed value
computed <length-percentage> value
Canonical order
per grammar
Animation type
by computed value

circle()

Function Baseline: widely availablesince July 2022

MDN The circle() CSS function defines a circle using a radius and a position. It is one of the basic-shape data types.

Live preview Example from MDN
#default-example {
  background: #ffee99;
}

#example-element {
  background: linear-gradient(to bottom right, #ff5522, #0055ff);
  width: 100%;
  height: 100%;
}

Syntax

/* for <basic-shape> */
circle( <radial-size>? [ at <position> ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting circle()
Chrome 37
Edge 79
Firefox 54
Safari 10.1
Chrome Android 37
Safari iOS 10.3

First version with support, from MDN browser-compat-data.

Defined for

<basic-shape>

This feature only appears in the context of these properties, functions or types.

ellipse()

Function Baseline: widely availablesince July 2022

MDN The ellipse() CSS function is one of the basic-shape data types.

Live preview Example from MDN
#default-example {
  background: #ffee99;
}

#example-element {
  background: linear-gradient(to bottom right, #ff5522, #0055ff);
  width: 100%;
  height: 100%;
}

Syntax

/* for <basic-shape> */
ellipse( <radial-size>? [ at <position> ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting ellipse()
Chrome 37
Edge 79
Firefox 54
Safari 10.1
Chrome Android 37
Safari iOS 10.3

First version with support, from MDN browser-compat-data.

Defined for

<basic-shape>

This feature only appears in the context of these properties, functions or types.

inset()

Function Baseline: widely availablesince July 2022

MDN The inset() CSS function defines a rectangle at the specified inset distances from each side of the reference box. It is a basic shape function used to define one of the basic-shape data types.

Live preview Example from MDN
#default-example {
  background: #ffee99;
}

#example-element {
  background: linear-gradient(to bottom right, #ff5522, #0055ff);
  width: 100%;
  height: 100%;
}

Syntax

/* for <basic-shape> */
inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting inset()
Chrome 37
Edge 79
Firefox 54
Safari 10.1
Chrome Android 37
Safari iOS 10.3

First version with support, from MDN browser-compat-data.

Defined for

<basic-shape>

This feature only appears in the context of these properties, functions or types.

path()

Function Limited availability

MDN The path() CSS function accepts an SVG path string, and is used in the CSS shapes and CSS motion path modules to enable a shape to be drawn. The path() function is a basic-shape data type value. It can be used in the CSS offset-path and clip-path properties and in the SVG d attribute.

Live preview Example from MDN
#default-example {
  background: #ffee99;
}

#example-element {
  background: linear-gradient(to bottom right, #ff5522, #0055ff);
  width: 100%;
  height: 100%;
}

Syntax

/* for <basic-shape> */
path( <'fill-rule'>? , <string> )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting path()
Chrome 52
Edge 79
Firefox 72
Safari 13.1
Chrome Android 52
Safari iOS 13

First version with support, from MDN browser-compat-data.

Defined for

<basic-shape>

This feature only appears in the context of these properties, functions or types.

polygon()

Function Baseline: widely availablesince July 2022

MDN The polygon() CSS function is one of the basic-shape data types. It's used to draw a polygon by providing one or more pairs of coordinates, each of which represents a vertex of the shape.

Live preview Example from MDN
#default-example {
  background: #ffee99;
}

#example-element {
  background: linear-gradient(to bottom right, #ff5522, #0055ff);
  width: 100%;
  height: 100%;
}

Syntax

/* for <basic-shape> */
polygon( <'fill-rule'>? [ round <length> ]? , [<length-percentage> <length-percentage>]# )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting polygon()
Chrome 37
Edge 79
Firefox 54
Safari 10.1
Chrome Android 37
Safari iOS 10.3

First version with support, from MDN browser-compat-data.

Defined for

<basic-shape>

This feature only appears in the context of these properties, functions or types.

rect()

Function Baseline: widely availablesince July 2026 Modern CSS: rect() and xywh()

MDN The rect() CSS function creates a rectangle at the specified distance from the top and left edges of the containing block. It is a basic shape function of the basic-shape data type. You can use the rect() function in CSS properties such as offset-path to create the rectangular path along which an element moves, in clip-path to define the shape of the clipping region, and in border-shape to define the shape of an element's border.

Live preview Example from MDN
.container {
  position: relative;
  display: inline-block;
  width: 200px;
  height: 200px;
  border: 1px solid black;
  margin: 15px;
  text-align: center;
}

.path {
  width: 40px;
  height: 40px;
  background-color: red;
  position: absolute;
  animation: move 10s linear infinite;
}

.rect-path-1 {
  offset-path: rect(50px 150px 200px 50px round 20%);
}

.rect-path-2 {
  offset-path: rect(50px auto 200px 50px round 20%);
}

.rect-path-3 {
  offset-path: rect(50px auto 200px auto);
}

@keyframes move {
  0% {
    offset-distance: 0%;
  }
  100% {
    offset-distance: 100%;
  }
}

Syntax

/* for <basic-shape> */
rect( [ <length-percentage> | auto ]{4} [ round <'border-radius'> ]? )

/* for clip */
rect( <top>, <right>, <bottom>, <left> )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting rect()
Chrome 119
Edge 119
Firefox 122
Safari 17.2
Chrome Android 119
Safari iOS 17.2

First version with support, from MDN browser-compat-data.

Defined for

<basic-shape>, clip

This feature only appears in the context of these properties, functions or types.

shape()

Function Baseline: newly availablesince February 2026 Modern CSS: shape()

MDN The shape() CSS function is used to define a shape for the border-shape, clip-path, and offset-path properties. It combines an initial starting point with a series of shape commands that define the path of the shape. The shape() function is a member of the basic-shape data type.

Live preview Example from MDN
body {
  align-items: center;
  justify-content: center;
  display: flex;
}

.container {
  position: relative;
  display: inline-block;
  width: 250px;
  height: 250px;
  border: 2px dotted green;
  margin: 20px;
}

@supports not (offset-path: shape(from 0 0, move to 0 0)) {
  body::after {
    content: "Your browser doesn't support the `shape()` function yet.";
    background-color: wheat;
    display: block;
    text-align: center;
    padding: 1rem 0;
  }
}

.shape {
  width: 50px;
  height: 50px;
  background: #2bc4a2;
  position: absolute;
  text-align: center;
  line-height: 50px;
  animation: move 6s infinite linear;
}

.shape1 {
  offset-path: shape(
    from 30% 60px,
    curve to 180px 180px with 90px 190px,
    close,
    move by 0px 150px,
    hline by 40%
  );
}

.shape2 {
  offset-path: shape(
    from 50px 90px,
    hline to 8em,
    move to 50px 90px,
    vline by 20%,
    close
  );
}

@keyframes move {
  0% {
    offset-distance: 0%;
  }
  100% {
    offset-distance: 100%;
    background-color: hotpink;
  }
}

Syntax

/* for <basic-shape> */
shape( <'fill-rule'>? from <position> , <shape-command># )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting shape()
Chrome 135
Edge 135
Firefox 148
Safari 18.4
Chrome Android 135
Safari iOS 18.4

First version with support, from MDN browser-compat-data.

Defined for

<basic-shape>

This feature only appears in the context of these properties, functions or types.

xywh()

Function Baseline: widely availablesince July 2026 Modern CSS: rect() and xywh()

MDN The xywh() CSS function creates a rectangle using the specified distances from the left (x) and top (y) edges of the containing block and the specified width (w) and height (h) of the rectangle. It is a basic shape function of the basic-shape data type. You can use the xywh() function in CSS properties such as offset-path to create the rectangular path along which an element moves, in clip-path to define the shape of the clipping region, and in border-shape to define the shape of an element's border.

Live preview Example from MDN
.container {
  position: relative;
  display: inline-block;
  width: 200px;
  height: 200px;
  border: 1px solid black;
  margin: 30px;
  text-align: center;
}

.path {
  width: 50px;
  height: 50px;
  position: absolute;
  background-color: magenta;
  animation: move 10s linear infinite;
}

.xywh-path-1 {
  offset-path: xywh(20px 20px 100% 100% round 10%);
}

.xywh-path-2 {
  offset-path: xywh(20px 30% 150% 200%);
}

@keyframes move {
  0% {
    offset-distance: 0%;
  }
  100% {
    offset-distance: 100%;
  }
}

Syntax

/* for <basic-shape> */
xywh( <length-percentage>{2} <length-percentage [0,∞]>{2} [ round <'border-radius'> ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting xywh()
Chrome 119
Edge 119
Firefox 122
Safari 17.2
Chrome Android 119
Safari iOS 17.2

First version with support, from MDN browser-compat-data.

Defined for

<basic-shape>

This feature only appears in the context of these properties, functions or types.

<basic-shape>

Type Baseline: widely availablesince July 2022

Spec The <basic-shape> type can be specified using basic shape functions.

MDN The <basic-shape> CSS data type represents a shape used in the border-shape, clip-path, offset-path, and shape-outside properties.

Live preview Example from MDN
#default-example {
  background: #ffee99;
}

#example-element {
  background: linear-gradient(to bottom right, #ff5522, #0055ff);
  width: 100%;
  height: 100%;
}

Syntax

<basic-shape-rect> | <circle()> | <ellipse()> | <polygon()> | <path()> | <shape()>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting <basic-shape>
Chrome 37
Edge 79
Firefox 54
Safari 10.1
Chrome Android 37
Safari iOS 10.3

First version with support, from MDN browser-compat-data.