< HyperText Markup Language < Tag List

Use

html wraps the whole HTML document. The opening tag is placed directly after the doctype declaration, the end tag at the end of the document.

It is recommended that the primary language of the document is indicated with either the lang attribute for HTML or the xml:lang attribute for XHTML. XHTML 1.0 documents served with a MIME type of text/html should use both lang and xml:lang.

Example

An English language HTML 4.01 document.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
  <head>
    <title>Example page</title>
  </head>
  <body>
    <p>Example paragraph.</p>
  </body>
</html>

An English language XHTML 1.0 document.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Example page</title>
  </head>
  <body>
    <p>Example paragraph.</p>
  </body>
</html>

Required attributes

xmlns

In XHTML 1.0 and XHTML 1.1 xmlns is required. xmlns defines the XML namespace. Its value in XHTML 1.0 and XHTML 1.1 is http://www.w3.org/1999/xhtml.

Standard attributes

Notes

This tag is optional in HTML 4.01, but it is strongly recommend to use it.

It is required in XHTML.

More info

The HTML element in HTML 4.01 Specification
The <html> tag on W3Schools

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.