(^578) Appendix A XHTML Reference
●All XML elements must be properly nested. Nesting is the use of one or more
elements inside other elements. The most recently opened element must be the
next one closed.
●All attribute values in XML must be contained in quotes.
●All XML documents must begin with a statement declaring it to be an XML
document. The XML Declaration is shown below:
<?xml version="1.0" encoding="UTF-8"?>
While this technique is preferred by the W3C, the metatag (see Chapter 2) is
more commonly used. The reason is that there are incompatibility and display
issues when the XML declaration is used with some browsers (such as certain
versions of Internet Explorer).
●All XML documents must have opening and closing tags that form the root ele-
ment within which all other elements in the document are contained. The
and tags serve this purpose for Web page documents.
A.2 General XHTML Syntax Guidelines
Since XHTML uses the syntax of XML, it must follow the XML syntax rules. The fol-
lowing guidelines specify examples of how this is accomplished when using XHTML:
- All XHTML elements (the tags and their attributes) should be lowercase.
- The and tags are required.
- The
tag is the first tag in the header section. - All container tags must use their opening and closing tags.
- All self-contained tags (sometimes called empty elements) must be properly
closed. For example, use
instead of
. - All attribute values should be contained in quotation marks.
- All attributes should have values. For example, use
<input type="checkbox" checked="checked" name="IE" id="IE"
value="yes" />
instead of.
- Tags should not overlap, they should be properly nested. For example, use
This is important
instead of
This is important. - The following tag-specific nesting restrictions apply:
● A - Formatting should be configured with style sheets and the tag should be
avoided. - The nameattribute is deprecated in XHTML 1.0 as applied to bookmarks and
named fragment identifiers. This has the greatest effect on and