xmlns attribute in HTML

The xmlns attribute for declaring the default namespace is a reserved attribute and not classified as either a global attribute or local attribute. Although it can be specified on any HTML element, best practices suggest to declare the namespace for the entire document on the <html> top element where it will be inherited by all of its descendants.

When the document is being parsed as HTML, the xmlns attribute is ignored, since all HTML elements are automatically assigned to the HTML namespace and the name of the xmlns attribute itself is allocated in the namespace partition with no namespace URI, along with the names of other global attributes.

When the document is being parsed as XML, the xmlns attribute name is allocated in the http://www.w3.org/2000/xmlns/ namespace, separate from the HTML global attributes in the HTML namespace.