Published on

What does `xmlns="http://www.w3.org/2000/svg"` in the SVG tag mean?

Authors
  • avatar
    Name
    hwahyeon
    Twitter

Namespace is a way to distinguish which standard or context an element or attribute belongs to in an XML document. It prevents tag name conflicts when combining different XML-based languages (e.g., XHTML, SVG, MathML) in a single document.

xmlns="http://www.w3.org/2000/svg" defines the namespace for the SVG file, ensuring that the browser correctly interprets the tags as SVG elements. This distinction allows tags like <rect> or <circle> to be recognized as SVG-specific elements, differentiating them from standard XML tags or elements from other namespaces.

For example, when using XHTML and SVG in the same document, the namespace ensures that an XHTML <table> and an SVG <table> serve different purposes without conflict.

In short, this attribute indicates that the SVG document adheres to the W3C XML-based standard and helps browsers and tools handle it correctly.