- Courses
- HTML
- HTML top level tags
- <html>
- Role of xmlns in the <html> element
What does the xmlns
attribute in the <html>
element specify?
The xmlns
attribute specifies the XML Namespace of the document.
The default value is http://www.w3.org/1999/xhtml
, and it is required in documents parsed with XML parsers and optional in text/html documents. This attribute ensures that the document is correctly interpreted within the XML framework, maintaining consistency and compatibility across different XML-based applications.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XML Namespace Example</title>
</head>
<body>
<p>Content goes here.</p>
</body>
</html>