<svg>...</svg>

HTML4 HTML5

The <svg> tag defines a container for Scalable Vector Graphics (SVG)[cite: 3]. It allows drawing 2D shapes, lines, paths, and text directly on web pages[cite: 3].

Graphics created this way are scalable without quality loss across any screen resolutions[cite: 3].

Both opening and closing tags are mandatory[cite: 3].

Attributes:

Example

In the example below, the <svg> tag draws a red circle and black text[cite: 3]:

Code:

<svg width="150" height="100" viewBox="0 0 150 100"> <circle cx="50" cy="50" r="40" fill="red" stroke="darkred" stroke-width="2" /> <text x="105" y="55" font-size="16" fill="black" text-anchor="middle">SVG</text> </svg>

The browser will interpret this code as follows:

SVG