# shape()

> The `shape()` CSS function defines a custom shape using a set of drawing commands.

## How do I make a responsive custom clip-path shape in CSS?

The function that describes a shape with commands like `line`, `curve` and `arc`, similar to SVG paths but with CSS units and `calc()`. Used in `clip-path` and `offset-path` to create responsive shapes.

- Topic: Shapes
- Type: function
- Browser support: Chrome 135+, Chrome Android 135+, Edge 135+, Firefox 148+, Firefox Android 148+, Safari 18.4+, Safari iOS 18.4+

## Example

Wrong:

```css
.banner {
  clip-path: path('M0 0 H600 V160 L0 200 Z');
}
```

Right:

```css
.banner {
  clip-path: polygon(0 0, 100% 0, 100% 80%, 0 100%);
  clip-path: shape(from 0 0, line to 100% 0, line to 100% 80%, curve to 0 100% with 50% 100%, close);
}
```

`shape()` accepts percentages, so the curve follows the element size, and the `polygon()` line is a fallback.

## Common mistakes

- Using `path()` and getting a shape that doesn't scale with the element.

## Key points

- Responsive shapes use `shape()` with percentages instead of a fixed-size `path()`.
- A `polygon()` or `path()` fallback is declared before the `shape()` one.

## Interview questions

### What is the difference between shape() and path()?

`path()` takes an SVG path string in fixed pixel units. `shape()` uses CSS syntax and accepts percentages, `calc()` and custom properties.

### Can I animate a shape() clip-path?

Yes, between two `shape()` values with the same list of commands, the browser interpolates each point.

## Related cards

- [clip-path](https://wonderium.dev/css/clip-path.md)
- [polygon()](https://wonderium.dev/css/polygon.md)
- [circle()](https://wonderium.dev/css/circle.md)
- [ellipse()](https://wonderium.dev/css/ellipse.md)
- [`<svg>`](https://wonderium.dev/html/svg.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/shape
- Last updated: 2026-11-25
