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

 

1 comment

  1. SVG Polygon - Example 1

    […] June 14, 2020 eduguru simple example of SVG polygon, SVG, SVG Polygon – Example, SVG Polygon – Example 1 […]

Comments are closed.