Animation Advanced

Responsive clip paths without SVG

Complex clip paths used to require SVG path() definitions with fixed coordinates that don't scale responsively. The CSS shape() function uses responsive units like percentages and viewport units for truly flexible shapes.

Old 8 lines
1.shape {
2  clip-path: path(
3    'M0 200 L100 0 L200 200 Z'
4  );
5}
6
7/* Fixed pixel coordinates */
8/* Doesn't scale with element size */
Modern
7 lines
1.shape {
2  clip-path: shape(
3    from 0% 100%,
4    line to 50% 0%,
5    line to 100% 100%
6  );
7}
the shape scales with the element
Triangle
Hexagon
Star
All using percentage-based coordinates — fully responsive

Responsive by default

Use percentages, em, rem, vw — any CSS unit. The shape scales with the element, unlike fixed-coordinate SVG paths.

CSS-native syntax

No SVG path mini-language to learn. Uses familiar CSS commands: line, curve, arc, smooth, with readable coordinate pairs.

Animatable

Unlike path(), shape() can be animated and transitioned between different shapes smoothly with CSS animations.

Browser Support
45%
Chrome Edge Firefox 🔜
View on caniuse.com →
Scalability
Responsive
Uses %, em, vw
Old Approach
path()
Fixed SVG coordinates
Modern Approach
shape()
CSS-native function

How it works

The SVG path() function brought complex shapes to CSS clip-path, but it inherited SVG's fixed coordinate system. A path defined with M0 200 L100 0 L200 200 only works for a 200×200 element. Resize it, and the clipping breaks.

The CSS shape() function solves this by using standard CSS coordinates and units. You write from 0% 100%, line to 50% 0%, line to 100% 100% — readable, responsive, and animatable. It supports lines, curves (quadratic and cubic), arcs, and smooth joins, all with CSS units that scale with the element.

ESC