The <polygon> Element

The <polygon> element is used for a shape with multiple (at least three) straight sides. Figure 03.15 and the following example show a hexagon with a red stroke and a gray fill.

Figure 03.15. A hexagon created using the <polygon> element.

Listing 3.17. (Polygon01.svg)
<?xml version="1.0" standalone="no"?> 
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" 
      "http://www.w3.org/TR/2001/PR-SVG-20010719/ 
       DTD/svg10.dtd"> 
<svg width="400" height="500" > 
<polygon style="fill:#CCC; stroke:red; stroke-width:3" 
points="150,75 258,137.5 258,262.5 
150,325 42,262.5 42,137.5" /> 
</svg> 

If you were so inclined, you could create a rectangle ...

Get Designing SVG Web Graphics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.