function

shape() — CSS reference

Draws a path using CSS commands rather than a quoted SVG string. Coordinates can use lengths, percentages and calculations. The tested line commands form a responsive triangle; curves and arcs need separate syntax review.

Formal Syntax & Structure

css syntaxcss
shape([ <fill-rule> ]? from <position>, <shape-command>#) (representative draft grammar)

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS masking and shapes lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}body{background:white} #a{position:relative;margin:20px;width:80px;height:60px;background:red;box-sizing:content-box}#a{clip-path:shape(from 0 0, line to 100% 0, line to 0 100%, close)}</style><body><div id="a" aria-hidden="true"></div><p>Decorative shape example.</p></body></html>
CSS Reference