html ElementThe html element is declared by the XHTML 1.1 Structure Module
Elements in the Structure Module are:html | head | title | body
The html element is used to enclose the entire XHTML document - apart from
any XML Prolog (see the XML Declaration & DOCTYPE for
more information).
This example shows the html element in context:
Despite being declared in the DTD as a #FIXED attribute, rather than a #REQUIRED one,
the xmlns attribute is actually compulsory on the
html element in order for the document to pass W3C Validation.
Its value is must be "http://www.w3.org/1999/xhtml" for every XHTML document.
Inclusion of the xmlns attribute explicitly states the
namespace name which applies to the document, without having to refer to the DTD.
Note: If the xmlns attribute is absent on the
html element, this may result in
the document's XHTML 1.1 status not being recognised in some user agents, with the specified function of each element being ignored
and content being rendered simply, with no special behaviour for tables, lists or forms, no intrinsically block elements, etc etc.
Conversely, the #FIXED version attribute
need not be included, perhaps because this information is available in the DOCTYPE declaration itself.
It is good practice to specify the language in which the document is written, using the
xml:lang attribute.
In the example above, the LanguageCode for British English, "en-GB", is used.
If a document is written in more than one language, pick the main language - you can then add appropriate
xml:lang attributes to those elements which contain text written in
another language. You can add xml:lang attributes to almost any element you desire.
You may not think that it is important to include such language information as there is no visible effect of including it when
viewing the page in a standard browser. It is invaluable information, however, for a screen reader for the blind, for example, as it can help
with pronunciation. Search engines may also use language tags to classify content.
Although the xmlns attribute is
declared as #FIXED and not #REQUIRED on the html element, it is compulsory in order for
the document to pass W3C Validation.
html element are listed below:html element are listed below:Note: Even though the
*XHTML 1.1 Structure Module DTD
specifies that the id attribute is
permitted on the html element, the *W3C Markup Validator
does not currently recognise this and a document which uses this attribute on the html element
will fail validation. I have therefore omitted the
id attribute on the html element in this reference.
dir [ type Enumeration (ltr | rtl) ], from the Bi-directional Text Modulexml:lang [ type LanguageCode ]html element is:
NOTE: This element cannot be empty
See Content Model & Nesting for information about Content Model syntax and Nesting Groups.
htmlbody, headhtmlThis is the root element and cannot have a parent.