HTML and CSS Reference
In-Depth Information
figure 9-5
Rules for well-formed XML
Rule
Incorrect
Correct
Element names must
be lowercase.
<P>Thisƒisƒaƒparagraph.</P> <p>Thisƒisƒaƒparagraph.</p>
Elements must be
properly nested.
<p>Thisƒtextƒisƒ
<b>bold.</p></b>
<p>Thisƒtextƒisƒ<b>bold.</b></p>
All elements must
be closed.
<p>Thisƒisƒtheƒfirstƒ
paragraph.
<p>Thisƒisƒtheƒsecondƒ
paragraph.
<p>Thisƒisƒtheƒfirstƒ
paragraph.</p>
<p>Thisƒisƒtheƒsecondƒ
paragraph.</p>
Empty elements must
be terminated.
Thisƒisƒaƒlineƒbreak.<br>
Thisƒisƒaƒlineƒbreak.<brƒ/>
Attribute names must
be lowercase.
<tdƒALIGN=”right”>
<tdƒalign=”right”>
Attribute values must
be quoted.
<tableƒwidth=620>
<tableƒwidth=”620”>
Attributes must
have values.
<optionƒselected>
<optionƒselected=”selected”>
In addition to the rules specified in Figure 9-5, all XML documents must also include a
single root element that contains all other elements. For XHTML, that root element is the
html element. You should already be familiar with most of these rules because you've
been working with well-formed HTML since Tutorial 1. However, if you examine older
Web pages, you may find document code that violates this basic syntax, but which most
browsers nonetheless support.
In some older HTML documents, you might find cases of attribute minimization , a
situation in which some attributes lack attribute values. XHTML does not allow attribute
minimization. Figure 9-6 lists the minimized attributes found in some HTML documents,
along with the XHTML-compliant versions of these attributes.
figure 9-6
Attribute minimization in HtML and XHtML
HTML
XHTML
compact
compact=”compact”
checked
checked=”checked”
declare
declare=”declare”
readonly
readonly=”readonly”
disabled
disabled=”disabled”
selected
selected=”selected”
defer
defer=”defer”
ismap
ismap=”ismap”
nohref
nohref=”nohref”
noshade
noshade=”noshade”
nowrap
nowrap=”nowrap”
multiple
multiple=”multiple”
noresize
noresize=”noresize”
For example, in HTML, the following code can be used to indicate that a radio button
should be selected by default:
<inputƒtype=”radio”ƒchecked>
Search WWH ::




Custom Search