SVG <polygon>
- Previous Page SVG Line
- Next Page SVG Line Chart
<polygon> tag is used to create a shape with at least three sides.
<polygon> tag
<polygon> tag is used to create a shape with at least three sides.
Please copy the following code into a text editor, then save the file as "polygon1.svg". Place this file in your web directory:
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg" <polygon points="220,100 300,210 170,250" style="fill:#cccccc; stroke:#000000;stroke-width:1" </svg>
Code Explanation:
The 'points' attribute defines the x and y coordinates of each corner of the polygon
The following example creates a quadrilateral:
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg" <polygon points="220,100 300,210 170,250 123,234" style="fill:#cccccc; stroke:#000000;stroke-width:1" </svg>
- Previous Page SVG Line
- Next Page SVG Line Chart