HTML SVG (Scalable Vector Graphics) is an XML-based markup language for describing two-dimensional vector graphics. The <svg> tag is used to define an SVG container in HTML. SVG is used for icons and any graphics that need to be scalable without losing quality.
HTML SVG
<svg>: The root element for SVG graphics. The width and height attributes define the dimensions of the SVG container.
<circle>: Draws a circle in the SVG.
<rect>: Draws a rectangle.
<line>: Draws a line.
HTML SVG with Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SVG Example</title>
<style>
.circle {
fill: blue;
stroke: black;
stroke-width: 2;
}
.rect {
fill: orange;
stroke: black;
stroke-width: 2;
}
</style>
</head>
<body>
<h1>SVG Shapes</h1>
<!-- SVG Definition -->
<svg width="500" height="300">
<!-- Circle -->
<circle class="circle" cx="100" cy="100" r="50" />
<!-- Rectangle -->
<rect class="rect" x="160" y="50" width="100" height="100" />
<!-- Line -->
<line x1="20" y1="150" x2="290" y2="150" stroke="red" stroke-width="3" />
<!-- Text -->
<text x="50" y="180" font-family="Arial" font-size="20" fill="black">Hello, SVG sakalacode!</text>
</svg>
</body>
</html>