SVG Polygon –

SVG Polygon – <polygon>

The <polygon> element is used to create a graphic that contains at least three sides.

Polygons are made of straight lines, and the shape is “closed” (all the lines connect up).

Polygon comes from Greek. “Poly” means “many” and “gon” means “angle”.

Example 1:

<!DOCTYPE html>
<html>
<body>

<svg height=”210″ width=”500″>
<polygon points=”200,10 250,190 160,210″ style=”fill:lime;stroke:purple;stroke-width:1″ />
Sorry, your browser does not support inline SVG.
</svg>

</body>
</html>

svg polygon
svg polygon

Code explanation:

  • The points attribute defines the x and y coordinates for each corner of the polygon

 

One thought on “SVG Polygon – <polygon>

Comments are closed.