HTML SVG Graphics
SVG defines vector-based graphics in XML format.
What is SVG?
SVG stands for Scalable Vector Graphics. It is a markup language for describing two-dimensional vector graphics. SVG is an XML-based format that allows you to create graphics using a set of geometric shapes, text, and images. One of the key advantages of SVG is that it is scalable, meaning that the graphics can be resized without loss of quality.
The HTML <svg> Element
The HTML <svg> element is used to embed scalable vector graphics (SVG) directly into an HTML document. SVG is an XML-based markup language for describing two-dimensional vector graphics, and it's used to create graphics and visualizations on the web.
Browser Support
Element | <sav> |
4.0 | |
3.0 | |
9.0 | |
10.1 | |
3.2 |
SVG Circle
SVG Rectangle
SVG Rounded Rectangle
SVG Star
SVG Logo
Example
<svg height="130" width="500">
<defs>
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
</linearGradient>
</defs>
<ellipse cx="100" cy="70" rx="85" ry="55" fill="url(#grad1)" />
<text fill="#ffffff" font-size="45" font-family="Verdana" x="50" y="86">SVG</text>
Sorry, your browser does not support inline SVG.
</svg>
You can click on above box to edit the code and run again.
Output
SVG Star
SVG Logo
Example
<svg height="130" width="500">
<defs>
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
</linearGradient>
</defs>
<ellipse cx="100" cy="70" rx="85" ry="55" fill="url(#grad1)" />
<text fill="#ffffff" font-size="45" font-family="Verdana" x="50" y="86">SVG</text>
Sorry, your browser does not support inline SVG.
</svg>
You can click on above box to edit the code and run again.
Output
Example
<svg height="130" width="500"> <defs> <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" /> <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" /> </linearGradient> </defs> <ellipse cx="100" cy="70" rx="85" ry="55" fill="url(#grad1)" /> <text fill="#ffffff" font-size="45" font-family="Verdana" x="50" y="86">SVG</text> Sorry, your browser does not support inline SVG. </svg>You can click on above box to edit the code and run again.