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:
width – container width[cite: 3].height – container height[cite: 3].viewBox – defines coordinate system and proportions[cite: 3].xmlns – XML namespace[cite: 3].class, id, and style are also used[cite: 3].In the example below, the <svg> tag draws a red circle and black text[cite: 3]:
Code:
The browser will interpret this code as follows: