Coding the html tag in HTML 5

 

ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.


If you find this helpful, please click the Google +1 Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)


PDF mobile

Compatibility with W3C HTML standards and XML Parsers

In the 2000 W3C standard version of HTML (and HTML version 5) all of the markup language elements are qualified with a namespace. The advantage of this is that the content can be aggregated with other content, or vice versa, without having the names of the elements from the two sources conflict with each other.

Even if the xmlns attribute is not coded, web browsers are supposed to assume that the tag names for all elements in a document are in the default HTML namespace. However, other types of user agents, which normally use more generic XML parsers, would not assume a namespace for elements by default. Therefore, the <html> tag should include an xmlns attribute, which specifies the namespace of the HTML elements in the document. In addition, the "html" tag name should be coded in lower case in the start tag and matching end tag. (These rules for coding HTML are in the HTML syntax section of the <html> tag reference.)

This is how the <html> tag should appear in HTML 5 documents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
   ...
</html>

See The <html> Tag in HTML 5 - What's New for further details.


Valid HTML 5