function

polygon() — CSS reference

Creates a closed polygon from x and y pairs. Percentages use reference-box width and height respectively. Nonzero is the default fill rule; evenodd changes how self-intersecting paths are filled.

Formal Syntax & Structure

css syntaxcss
polygon([ <fill-rule> , ]? [ <length-percentage> <length-percentage> ]#) (core 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:polygon(0 0,100% 0,0 100%)}</style><body><div id="a" aria-hidden="true"></div><p>Decorative shape example.</p></body></html>
CSS Reference