HTML5 introduced very special element knon as SVG element which is stands for scalable vector graphics. HTML5 SVG Tag is basically designed to create vector graphics in XML format like 2D, charts etc. It is the recommendation of W3C. The <svg> element is used as ccontainer for SVG graphics.
All most all the web browsers support SVG just like any image format like PNG, GIF, and JPG. SVG element provides several built in methods for drawing paths, rectangle, circles, text, and graphic images. Internet Explorer users may have to install the Adobe SVG Viewer to be able to view SVG in the browser.
Syntax
<svg width="100" height="100"> SVG method will come here... </svg>
Almost all latest browsers like Safari, Google Chrome, Mozilla Firefox, Opera, Internet Explorer 9.0 support many HTML5 features and functionalities. The good thing is that now many mobiles web browsers like iPhones, iPads, and Android phones all have excellent support for HTML5.
![]() |
![]() |
![]() |
![]() |
![]() |
Example
<!DOCTYPE HTML> <html> <head> <meta charset=UTF-8" /> <title>HTML5 SVG Element Line Example</title> </head> <body bgcolor="#fvvyee"> <svg width="100" height="100"> <line x1="10" y1="10" x2="10" y2="100" stroke-width="3" stroke="blue"/> </svg> </body> </html>
This will produce following result
Example
<svg width="130" height="300"> <circle cx="50" cy="50" r="40" stroke="blue" fill="red"/> </svg>
This will produce following result
Example
<svg width="120" height="120"> <ellipse cx="60" cy="60" rx="50" ry="25" stroke="blue" fill="red"/> </svg>
This will produce following result
Example
<svg width="120" height="120"> <rect x="10" y="10" width="100" height="100" stroke="blue" fill="red"/> <rect x="120" y="10" width="100" height="100" rx="15" ry="15" stroke="black" fill="yellow"/> </svg>
This will produce following result
Example
<svg width="120" height="120"> <polygon points="60,20 100,40 100,80 60,100 20,80 20,40" stroke="black" fill="red"/> </svg>
This will produce following result