The <html> Tag

The <html> tag in HTML 5

The <html> tag is the tag for the top element of an HTML document. The parent of the <html> tag is the root node of the DOM .

Converting to HTML 5

We are working on converting to HTML 5. Please visit HTML <html> Tag on the HTML 5 standard version of this site.

<html> Tag Syntax

Syntax of the <html> tag

Attributes of the <html> Tag

Attributes of the <html> tag

attribute
The attribute
common attributes
In addition to the attributes above, which are specific to the <html> tag, any of the common HTML attributes can also be used.
Contents of the <html> Tag

Contents of the <html> tag

The <html> element typically contains the following tags:

HTML 5 Examples

Examples of the html tag in HTML 5

This is how the <html> tag should appear:

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

The <html> tag should always include an xmlns attribute, which specifies the namespace of the HTML elements in the document. See the Differences below for more details.

Changes in HTML 5

What's new in HTML 5

Differences between HTML 5 and earlier versions

In the 2000 W3C standard version of HTML (and HTML version 5) the <html> tag includes an xmlns attribute, which specifies the namespace of the HTML elements in the document. Here is how the <html> tag should appear:

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

In addition to being required by the 2000 W3C standard, specifying the namespace for the elements in the document using the xmlns attribute allows the documents, or a subset of nodes in the document, to be aggregated with other content. If the namespace for the elements is not specified, a reader of a combined documents created by an aggregator will be unable to distinguish the elements in one namespace from those in another. This is the biggest limitation of RSS 0.92 version 2.0 although RSS version 1.0 does use namespaces to solve the problem.

The following attributes should not be coded on the <html> tag because they either have been deprecated or were never officially supported:

  • version - use the xmlns attribute described above instead

Last updated Sunday September 19, 2010


Printer-friendly PDF* format:

The <html> Tag

You are currently viewing this page in XHTML 1 Style Sheet* format (* see Clicklets for more infomation). This document is also available in XHTML 1*XML*HTML 4*HTML 5 Style Sheet*HTML 5 XML*HTML 5 non-XML* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.