HTML xmlns
Have you ever encountered a website that contains "html xmlns
" in the source code, near the top of the document and wondered why it was there?
Actually, it would've looked more like this:
Look familiar?
Well, this piece of code is a declaration. It is a declaration for the XML namespace. All XML documents must have an xmlns
declaration for the XML namespace.
As you can see from the above example, the xmlns
delaration is an attribute of the <html>
element. You can see that the value of the xmlns
attribute is http://www.w3.org/1999/xhtml
- which is the official XHTML namespace (as defined in the official XHTML specification). You can also see that English is defined as the language of the document (i.e. using xml:lang="en
and lang="en"
). But of course, the document doesn't need to be written in english - it could be written in any language. For other languages, here's a full list of langugage codes
More About XHTML
Check out the XHTML tutorial to see the differences between XHTML and HTML.
The Future of XHTML
Although XHTML was originally dubbed as the replacement for HTML, things have changed. XHTML is no longer being developed by the W3C. Instead of continuing with XHTML, the W3C decided that HTML5 would be the way forward for documents on the web. Therefore, the number of web pages containing html xmlns
in their source code is expected to dwindle!