HyperText Markup Language/Tag List/html
From Wikibooks, the open-content textbooks collection
Contents |
[edit] 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.
[edit] 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>
[edit] Required attributes
[edit] 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.
[edit] Standard attributes
[edit] dir
[edit] lang
[edit] xml:lang
[edit] Notes
This tag is optional in HTML 4.01, but it is strongly recommend to use it.
It is required in XHTML.
[edit] More info
The HTML element in HTML 4.01 Specification
The <html> tag on W3Schools