Nesting Requirements
It has always been a rule in HTML that elements should be properly nested within one another. The closing tag of a contained element should always appear before the closing tag of the element that contains it. In XHTML, this rule is strictly enforced. So be sure that your elements are nested correctly, like this:
<p>I can <em>fly!</em></p>
and not overlapping like this:
<p>I can <em>fly!</p></em>
In addition, XHTML enforces other nesting restrictions that have always been a part of the HTML specification. The XHTML DTD includes a special “Content Models for Exclusions” note that reinforces the following:
An
aelement cannot contain anotheraelement.The
preelement cannot containimg,object,applet,big,small,sub,sup,font, orbasefont.The
formelement may not contain otherformelements.A
buttonelement cannot containa,form,input,select,textarea,label,button,iframe, orisindex.The
labelelement cannot contain otherlabelelements.