You are here: Home > SVG Elements > svg element
Introduction
The <svg> element represents the root node of an SVG document or image. When included in an XML context (inline with XHTML or as a standalone SVG document), the <svg> element must include the SVG namespace (see Usage below).
Details
Usage
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 300 200">
<!-- rest of SVG document goes here -->
</svg>
Attributes
Common attributes:
- width - if unspecified this value is 100%
- height - if unspecified this value is 100%
- viewBox - represents the coordinate system of the SVG document
DOM API
The <svg> element supports the DOM SVGSVGElement interface. Some of the noted methods of SVGSVGElement are: