XHTML » Tags » html

<html> ... </html>

The html tag informs the browser that this is an HTML encoded program. The html opening and closing tags delimit the start and stop of the document.

The only tag that can precede the opening html tag is the DOCTYPE tag. It is used to select the XHTML DTD (Document Type Definition) that sets the rules and syntax for the XHTML document.
A well-formed XHTML document must contain properly nested and closed html, head, title, and body tags.
Although it is not a requirement, it is strongly recommended that the opening html tag contain information defining the language being used for both the XHTML document and for XML. This is set respectively with the lang and the xml:lang attributes. In addition, the html tag should also contain the XML namespace declaration (xmlns). This is demonstrated for English with the following code.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
The separate closing tag is mandatory.


<?xml version="1.0" encoding="UTF-8"?>
<!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">
<title>DevGuru XHTML html Tag Example</title>
body content goes here...
body content goes here...

This example demonstrates the basic structure of an XHTML program.

Language(s): XHTML

See Also: