Basic Rules of XHTML

Because you now have to follow the rules when writing XHTML, it's important that you spend some time understanding what those rules are. In some cases, following a rule means just a simple behavior change; in others, it seems like you are working with a vastly different language.

Listing 2.1 shows some HTML code that is not XHTML compliant. Indeed, the code is technically not even compliant with the syntax rules put forward in the HTML standard. In spite of this, a browser still renders it with no problem (see Figure 2.1).

Figure 2.1. The fact that browsers render HTML with syntax errors has led to widespread sloppy coding practices.
Code Listing 2.1. A Sample HTML Document
 <HTML> <HEAD> <TITLE>OnlinePizza.Com Order Form</TITLE> ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.