Name

html — HTML 4.01 | HTML5

Synopsis

<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. In HTML, if the tags are omitted, html is still implied as the root element.

Start/End Tags

HTML: Optional/Optional; XHTML: Required/Required

Attributes

Internationalization, HTML5 Global Attributes

id="text"

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

manifest="URL"

HTML5 only. Points to a cache used with the offline web application API.

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

Deprecated in HTML 4.01. Not in HTML5. 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 (HTML)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/HTML4.01/strict.dtd">
<html>
  <head>
    <title>Document Title</title>
  </head>
  <body>
    <p>Content of document . . . </p>
  </body>
</html>

Example (XHTML)

<!DOCTYPE html PUBLIC ...

Get HTML & XHTML Pocket Reference, 4th 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.