SVG

Scalable Vector Graphics

Example

SVG describes graphics as shapes in XML. It stays sharp at any size and each shape can be styled with CSS. Ideal for logos, icons and simple charts:

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
</head>
<body>

<svg width="300" height="120" viewBox="0 0 300 120">
  <rect x="10" y="10" width="100" height="60" rx="8" fill="#04AA6D" />
  <circle cx="170" cy="40" r="30" fill="#ffd43b" stroke="#282A35" stroke-width="3" />
  <line x1="220" y1="10" x2="290" y2="70" stroke="#ff6b6b" stroke-width="4" />
  <text x="10" y="105" font-family="Arial" font-size="18">SVG is sharp at any size</text>
</svg>

</body>
</html>

Result

SVG vs Canvas

SVGCanvas
Modelshapes in the DOMa bitmap of pixels
Scalingsharp at any sizeblurry when scaled up
Eventsper shape (click a circle)only on the whole canvas
Best foricons, logos, maps, simple chartsgames, many moving objects, image processing