The BODY Section

The rest of the document is pretty straight-forward. Again, all tags must be lower case, properly nested, and must have end tags. To convert an existing HTML document to XHTML, after you have added the proper <!DOCTYPE> and <html xmlns=…> tags, you first convert all the tags to lower case. Make sure all tags (including <br>, <meta> and especially <p>) have proper ending tags or use the ending shortcut />.

Next you have to make sure all attributes are quoted. <font size=1> is not valid in XHTML, it should be <font size=”1″>. Stand-alone attributes are not allowed any more either. A stand-alone attribute is one that has no value, as in <option selected&gt. Now these stand-alone attributes should be assigned a value like <option selected=”selected”>.

Lastly, one other rule that is not mentioned but is enforced in XHTML is that “inline” tags cannot contain “block-level” tags. The “inline” tags are:

Inline Tags
a br span bdo object
applet img map iframe tt
i b big small u
s strike font basefont em
strong dfn code q sub
sup samp kbd var cite
abbr acronym input select textarea
label button

The “block-level” tags are:

Block Tags
p h1-h6 div ul ol
dl menu dir pre hr
blockquote address center noframes isindex
fieldset table

So an inline element cannot contain a block-level element. For instance:

<font face="Arial" size="2">
<table border="0">
<tr><td>Hello!</td></tr>
</table>
</font>

is invalid. The font element cannot contain the table element.