HTML and CSS Reference
In-Depth Information
The initial version of XHTML was XHTML 1.0, an XML vocabulary based on the
specifications for HTML 4.0. A follow-up version, XHTML 1.1, provided a restructuring
of XHTML 1.0 in which different elements are placed within programming modules.
This allowed browser developers to support only those parts of XHTML 1.1 that were
relevant to their products. For example, a browser developed for people who are visually
impaired would not need to support purely visual aspects of XHTML.
After XHTML 1.1, the W3C supported the development of XHTML 2.0, which was
designed to be a complete departure from the earlier XHTML versions. In fact, XHTML 2.0
documents would not be backward compatible and thus would not be able to be ren-
dered on older browsers. Because of this aspect, XHTML 2.0 received little support in the
browser market and work on it was discontinued in 2009, leaving HTML5 as the de facto
Web document standard for the future. Because the final specifications for HTML5 are still
being developed, XHTML5 is in the experimental stage at the time of this writing.
Creating an XHTML Document
Because XHTML documents are also considered XML documents, the first line of an
XHTML file contains a statement called a prolog that indicates the document adheres to
the syntax rules of XML. The form of the XML prolog is
<?xmlƒversion=” value ”ƒencoding=” type ”ƒ?>
where the version attribute indicates the XML version of the document and the encoding
attribute specifies its character encoding. For XHTML documents, you set the value of the
version attribute to 1.0. The encoding type depends on the character set being used. For
example, if a document is saved using the UTF-8 character set, you would apply the follow-
ing XML prolog:
<?xmlƒversion=”1.0”ƒencoding=”UTF-8”ƒ?>
With XHTML documents, you also can include the character encoding using the meta
element
<metaƒhttp-equiv=”Content-type”ƒcontent=”text/html;charset=” type ”ƒ/>
where type is once again the character encoding. Thus, the meta element
<metaƒhttp-equiv=”Content-type”ƒcontent=”text/html;charset=”UTF-8”ƒ/>
defines the content type as using the UTF-8 character set.
Adding an XML Prolog
• To declare that a document is written in XML, enter
<?xmlƒversion=” value ”ƒencoding=” type ”ƒ?>
as the first line of the file, where the version attribute indicates the XML version of
the document and the encoding attribute specifies the character encoding.
• For XHTML documents, use the following prolog:
<?xmlƒversion=”1.0”ƒencoding=” type ”ƒ?>
You also should add the meta element
<metaƒhttp-equiv=”Content-type”ƒcontent=”text/html;charset=” type ”ƒ/>
where once again type specifies the character encoding.
Search WWH ::




Custom Search