Previous: [SVG] How to draw a rectangle?
<svg height="210" width="500"> <polygon points="200,10 250,190 160,210" style="fill:lime;stroke:yellow;stroke-width:1"/> </svg>
Here is what the above code looks like in HTML5:
- If you have noticed, we did not define the width and height of the previous svg, and its default value is 300*150.
- And this time we must define the width and height of the svg, because the polygons we draw cannot be fully displayed. We must define an area that can accommodate polygons. The default value of 300*150 is obviously not what we want. So we defined 210*500.