<html> The Document ElementThis element is supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1. Here are its attributes:
The document element for all XHTML elements is <html> , which is how XHTML matched the <HTML> element in HTML documents. This element must contain all the content of the document, as in this example: <?xml version="1.0"?> <!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"> <head> <title> Welcome to my page </title> </head> <body> <h1> Welcome to XHTML! </h1> </body> </html> The document element is very important in XML documents, of course. Note that this is one of the big differences between XHTML and HTML: In HTML, the <HTML> tag is optional because it's the default. To be valid XHTML, a document must have a <html> element. Of all the attributes of this element, only one is required: xmlns , which sets the XML namespace. Most XML applications set up their own namespace to avoid overlap, and XHTML is no exception; you must set the xmlns attribute to "http://www.w3.org/1999/xhtml" in XHTML documents. This tag also supports the lang and xml:lang attributes to let you specify the language of the document. If you specify values for both these attributes, the xml:lang attribute takes precedence in XHTML. In XHTML, the <html> element can contain a <head> and a <body> element (or a <head> and <frameset> element in the XHTML 1.0 Frameset document). |