<svg>

The svg element is the root container for inline Scalable Vector Graphics within HTML.

Since HTML5 Spec ↗

Syntax

<svg viewBox="0 0 W H">...</svg>

Examples

<svg viewBox="0 0 100 100" width="80" role="img" aria-label="Blue circle">
  <circle cx="50" cy="50" r="40" fill="royalblue" />
</svg>
Output
Renders a crisp 80px blue circle that scales without pixelation.

Notes

Prefer viewBox over fixed width/height for responsive scaling. For meaningful graphics add role="img" and aria-label or a <title>; mark decorative SVGs aria-hidden="true".

Browser & runtime support

EnvironmentSince version
chrome 4.0
firefox 4.0
safari 3.2
edge 12

See also