SVG stands for Scalable Vector Graphics. It is an XML-based format used to create vector graphics directly inside HTML pages.
The HTML SVG element acts as a container for vector graphics.
<svg width="100" height="100"> ... </svg>
SVG can draw circles, rectangles, lines, polygons, text and much more.
<svg width="100" height="100"> <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow"/> </svg>
<svg width="400" height="120"> <rect x="10" y="10" width="200" height="100" stroke="red" stroke-width="6" fill="blue"/> </svg>
<svg width="400" height="180"> <rect x="50" y="20" rx="20" ry="20" width="150" height="150" style="fill:red; stroke:black; stroke-width:5; opacity:0.5"/> </svg>
| SVG | Canvas |
|---|---|
| Vector based | Pixel based |
| Objects are remembered | Objects are not remembered |
| Better for icons and diagrams | Better for games and animations |
| Uses XML | Uses JavaScript drawing |
What does SVG stand for?