This well-formed and valid XHTML document has a self-closing div (<div />
) with a red background above this paragraph. According to the rules of XML, this should be equivalent to <div></div>
and therefore you shouldn't see it. However, when treated like HTML, the /
in the self-closing tag is treated as a markup error and is simply ignored, so what the browser sees is equivalent to <div>
. As a result, the rest of the document is seen as being inside the div, and the browser thinks the page is a mess.