Name

html — <html> . . . </html>

This is the root element of HTML and XHTML documents, meaning all other elements are contained within it. The html element has no ancestors. The opening <html> tag is placed at beginning of the document, just after the document type declaration. The closing tag goes at the end of the document.

Attributes

Internationalization

id="text"

XHTML only. Assigns a unique identifying name to the element.

version="-//W3C//DTD HTML 4.01//EN"

Deprecated in HTML 4.01 . In HTML, the value of version is a Formal Public Identifier (FPI) that specifies the version of HTML the document uses (the value above specifies 4.01). In HTML 4.01, the version attribute is deprecated because it is redundant with information provided in the DOCTYPE declaration. In XHTML 1.0, the value of version has not been defined.

xmlns="http://www.w3.org/1999/xhtml"

Required for XHTML only . In an XHTML document, this declares the XML namespace for the document.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Document Title</title>
  </head>
  <body>
    <p>Content of document . . . </p>
  </body>
</html>

Get HTML and XHTML Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.