Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
More


SVG Polygon
SVG Polygon

SVG Polygon is used to draw plygons on webpage, it uses <polygon> element to draw a polygon. Polygon has some attributes such as points, stroke, stroke-width, fill etc. These attributes help polygon to draw a polygon on a page.

Syntax

<polygon points="values" stroke="color" fill="color"> </polygon>


You can define one or more than one SVG polygons in a document.


Example

Sorry, your browser does not support SVG element.
Stroke Width

Stroke width attribute is used to make stroke thick and bold, it takes value in number.

Syntax

<polygon points="values" stroke="color" stroke-width="value" fill="color"> </polygon>


You can define one or more than one attributes in SVG rectangle.


Example

Sorry, your browser does not support SVG element.

You can use SVG polygon any where within an HTML document.


Practice Task

Open notepad or any other text editor, follow the following points.


  • Use <svg> element to draw svg polygon on webpage
  • Give width and height of 300 300 respectivelly to SVG element
  • Fill color should be olive

save file with name task.html or task.htm and then open it using any browser and see results.


Solution

Sorry, your browser does not support SVG element.

SVG Code Generators

Try our SVG generators to practice and generate SVG code in real time.