SVG is used for graphs like Pie charts, 2D graphs in X,Y coordinate system. It stands for Scalable Vector Graphics and it is a method for describing graphics in xml and then xml is rendered by SVG viewer.
Using SVG in HTML5:
We can use SVG by <svg></svg> tag in HTML5.
Syntax:
<svg xmlns="http://www.w3.org/2000/svg">
...
</svg>
Following is an example that will show how to draw a circle using svg:
<!DOCTYPE html>
<html>
<head>
<style>
#circlesvg {
position: relative;
left: 50%;
-webkit-transform: translateX(-20%);
-ms-transform: translateX(-20%);
transform: translateX(-20%);
}
</style>
<title>Circle using SVG</title>
<meta charset="utf-8" />
</head>
<body>
<h2 align="center">Circle using SVG HTML5</h2>
<svg id="circlesvg" height="300" xmlns="http://www.w3.org/2000/svg">
<circle id="greencircle" cx="30" cy="30" r="40" fill="green" />
</svg>
</body>
</html>
0 Comment(s)