I'm trying out different web page compositors and most of them start out with a basic structure like this when I create a new project:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Web Project</title>
</head>
<body>
<h1>New Web Project Page</h1>
</body>
</html>
I wasn't really able to find an answer as to why there needs to be an xmlns
if it's going to be a normal web page. I know I can omit it if I so desire, I've been writing HTML5 documents before and it was working fine without it.
So when is it actually necessary to provide an xmlns
in the <html>
element and why do compositors think it should be there when I create a new project? Is there any significance providing an xmlns
with the <html>
tag when doing HTML5 in the first place? Is there any benefit adding it?
On a regular HTML5 page you don't need it. However, if you want XML-serialized HTML5 (i.e. XHTML) then you add the XML namespace. For example the web framework JSF uses XML-serialized HTML, so there would be one reason to use it.
The HTML validator at http://w3.org does not complain when the xmlns attribute is missing in an XHTML document. This is because the namespace "xmlns=http://www.w3.org/1999/xhtml" is default, and will be added to the tag even if you do not include it.
From http://www.w3schools.com/tags/att_html_xmlns.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With