EKsumic's Blog

let today = new Beginning();

Click the left button to use the catalog.

OR

[SVG] How to draw polygons?

Previous: [SVG] How to draw a rectangle?

Code:

<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.

Next: [SVG] How to draw a straight line?

This article was last edited at 2020-12-09 12:39:19

* *