Skip to main content

HTML Guide

Bad value “” for the attribute “xmlns” (only “http://www.w3.org/2000/svg” permitted here).

Ensure the xmlns attribute for <svg> elements is set to “http://www.w3.org/2000/svg”.

In HTML documents, the xmlns attribute in an <svg> element must be defined correctly. The xmlns attribute specifies the XML namespace for an SVG element, which should always be “http://www.w3.org/2000/svg”. If you receive a validation error indicating a bad value for xmlns, it means that the attribute is empty or incorrectly set. This namespace ensures that the SVG elements are properly recognized as SVGs by the browser and aids in maintaining proper structure and function.

Here’s a correct example of an <svg> element:

<!DOCTYPE html>
<html lang="en">
  <body>
    <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
      <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
    </svg>
  </body>
</html>

Ensure that every <svg> element you use includes the xmlns attribute with the correct value to avoid validation issues and ensure complete browser compatibility.

Learn more:

Related W3C validator issues