How to use Polygon predefine SVG shape in XML
Posted in
XML | SVG July 05, 2019
In this article I have describe about two examples of Polygon in XML
Read about SVG here
Read about SVG shape hear
Polygon predefine SVG shape in XML
<polygon> is use to create a Polygon shape
The polygon have minimum three line and the lines create a close shape. The meaning of polygon is poly means "many" and gon means "angle" .
Example 1:
<?xml version="1.0" encoding="utf-8" ?>
<html>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<polygon points="100,5 150,90 60,110"
style="fill:lime;stroke:purple;stroke-width:1"/>
</svg>
</body>
</html>
|
Output
Define the code
- Xml define the namespace and version use the program.
- The points defines each corner of the polygon.
- Points define x and y coordinates of each corner.
- The line are create a close polygon.
Example 2:
<?xml version="1.0" encoding="utf-8" ?>
<html>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<polygon points="80,8 32,144 154,48 8,48 128,144"
style="fill:lime;stroke:purple;stroke-width:5; fill-rule:nonzero;"/>
</svg>
</body>
</html>
|
Output
Define the code
- Xml define the namespace and version use the program.
- The points defines each corner of the polygon.
- Points define x and y coordinates of each corner.
- The line are create a close polygon.
You may also want to read these related articles :
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here