Syntax | This element uses separate opening and closing tags.<html>...</html> |
---|---|
Usage | The <html> tag is the root tag. All of the other HTML tags are contained between the opening and closing <html> tags. The <html> tag comes after the DOCTYPE declaration. HTML <html> tag example. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>HTML Test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <p>This is a simple HTML web page.</p> </body> </html> XHTML <html> tag 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"> <head> <title>HTML Test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <p>This is a simple XHTML web page.</p> </body> </html> |
Content Model | The <html> element can contain the following tags between its opening and closing tags when using DTD Transitional and Strict documents. The <html> element can contain the following tags between its opening and closing tags when using DTD Frameset documents. |
Required | Tag Specific | Core | Focus | Events | Language |
---|---|---|---|---|---|
xmlns1 | version2 | id1 | dir lang xml:lang1 | ||
Notes: 1. XHTML only. 2. HTML only. |
Attribute | Description |
---|---|
xmlns | The xmlns attribute is used to specify the XML namespace for an XHTML document. This attribute is required for XHTML but it is not used for HTML. XHTML <html> tag example using the xmlns attribute. <html xmlns="http://www.w3.org/1999/xhtml"> Note: XHTML only. Note: This is a required attribute. |
version | The version attribute specifies which DTD defines the version of the current document. The version attribute has been deprecated because it is redundant with version information that is supplied by the DOCTYPE declaration. Note: HTML only. Note: This attribute has been deprecated. |
id | The id attribute assigns a unique name to a tag. This allows style sheets or scripts to reference the tag. See id Example Note: XHTML only. |
dir | The dir attribute tells the browser whether the text should be displayed from left-to-right or right-to-left. It does not reverse the direction of the characters, like the <bdo> tag does, but it can help the browser to determine if the text should be aligned on the left side or the right side. See dir Example |
lang | The lang attribute specifies a language. This attribute can help the browser to correctly display text. This attribute can also be useful for braille translation software, speech synthesizers, dictionary definitions, etc. See lang Example |
xml:lang | The xml:lang attribute specifies a language for XHTML documents. This attribute can help the browser to correctly display text. This attribute can also be useful for braille translation software, speech synthesizers, dictionary definitions, etc. See xml:lang Example Note: XHTML only. |
<html> tag example. |