O'Reilly logo

Platinum Edition Using XHTML™, XML, and Java™ 2 by Andrew H. Watt, Mike Morgan, Jim O'Donnell, Eric Ladd

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required