Skip to main content

HTML Guide

Attribute “xmlns:svg” not allowed here.

The xmlns:svg attribute is not allowed on the <svg> element in HTML5 and causes validation errors.

The SVG specification only requires the xmlns (not xmlns:svg) attribute for embedding SVG in HTML, and custom namespace prefixes like xmlns:svg are not needed or permitted in HTML5. The sole required namespace declaration is xmlns="http://www.w3.org/2000/svg". The xmlns:svg form was only used in extremely outdated XML-based workflows and has no place in current HTML.

Incorrect HTML Example:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
  <!-- SVG content here -->
</svg>

Correct HTML Example:

<svg xmlns="http://www.w3.org/2000/svg">
  <!-- SVG content here -->
</svg>

In summary:

  • Use only xmlns="http://www.w3.org/2000/svg" in inline SVG within HTML documents.
  • Remove xmlns:svg and any other prefixed namespace attributes unless specifically required for XML workflows, not HTML.

Learn more:

Related W3C validator issues