XHTML is somewhat different from HTML in the way that most browsers treat the code. Where with HTML the browser will attempt to make sense of invalid code, this does not happen in most browsers when you have XHTML.
Everything is completely different with XHTML. The XHTML standard does not require browsers to handle any coding errors in the XHTML. In most of the web browsers that actually support XHTML the XHTML page will not be displayed if there are any errors in the code at all. For example suppose we have the following XHTML web page that contains two errors:
Now of course whether your XHTML is valid or not it will still be offered for download by browsers that cannot display XHTML at all (such as Internet Explorer 8 and earlier). Where the browser does support XHTML most will report an error when you have any errors in the XHTML instead of displaying the web page.
Because the close of the paragraph and body from an XHTML web page are missing from the above XHTML only Internet Explorer 9 will still display the page. If we try to display the page in Firefox 5 we get the following message instead of our web page:
XML Parsing Error: mismatched tag. Expected: </p>.
Line Number 6, Column 101:
The browser has reported the first mismatched tag that it found. Even if we fix that error by adding back the close of the paragraph we will still get another error message because the closing body tag is still missing.
To see how the various browsers handle XHTML errors simply view the invalid XHTML web page in each browser.
This article written by Stephen Chapman, Felgall Pty Ltd.