The HTML SVG is an acronym which stands for Scalable Vector Graphics.
HTML SVG is a modularized language which is used to describe graphics in XML. It describe two-dimensional vector and mixed vector/raster graphics in XML. It is a W3C recommendation. SVG images and their behaviors are defined in XML text files. So as XML files, you can create and edit an SVG image with text editor, but generally drawing programs like inkspace are preferred to create it.
SVG is mostly used for vector type diagrams like pie charts, 2-Dimensional graphs in an X,Y coordinate system etc.
The <svg> element specifies the root of a SVG fragment. You can animate every element and every attribute in SVG files.
HTML SVG Circle Example
Let's see the example to draw circle by svg tag.
Here, we are using cx, cy and r attributes of circle tag. These attributes can't be used with svg rect tag.Test it Now
HTML SVG Rectangle Example
Let's see the example to draw rectangle by svg tag.
Here, we are using width and height attributes of rect tag.Test it Now
HTML SVG polygon Example
Let's see the example to draw polygon by svg tag.
Here, we are using points attribute of polygon tag.Test it Now
Why SVG is preferred over other image formats?
SVG images can be saved as the smallest size possible. Unlike bitmap image formats like JPG or PNG, it does not contain a fixed set of dots. So it is also easy to print with high quality at any resolution.
SVG images can be zoomed to a certain level without degradation of the picture quality.
SVG images and their behaviors are defined in XML text files, so they can be created and edited with any text editor.