You are here: Reference > HTML > attributes > xmlns (html)

xmlns attribute (html)

Browser support:
Declares a namespace for custom tags.
The xmlns attribute is useful if you want to create custom elements with namespace in a HTML document. Declare a namespace first and import element behaviors into it with the ?IMPORT processing instruction in HTML or with the doImport method in JavaScript. For a detailed description, please see the pages for the ?IMPORT PI and the doImport method.

Possible values:

String that sets the prefix and the Uniform Resource Name (URN) of the namespace. The syntax of this value is based on the Namespaces in XML 1.0 (W3C) specification.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the xmlns attribute:
<html xmlns:myNS="">
    <script type="text/javascript">
        var namespace = document.namespaces("myNS");
    <myNS:span>Move the mouse over this text (element with behavior)</myNS:span><br />
    <span>Move the mouse over this text (element without behavior)</span>
Did you find this example helpful? yes no

Supported by tags:

External links:

User Contributed Comments

Post Content

Post Content