XHTML, specifically XHTML 1.0 Transitional, will be our standard language for marking up web pages.
Loosely speaking, XHTML is XML that acts like HTML in old and new web browsers and also works as expected in most Internet devices, from Palm Pilots to web phones to screen readers, making it portable, practical, and cost efficient.
XHTML is as easy to learn and use as HTML—a little easier for newcomers who have no bad habits to unlearn, and perhaps a little harder for old hands who embraced web design and development in the wild and wooly 1990s.
XHTML is the current markup standard (replacing HTML 4), and it's designed to return rigorous, logical document structure to web content, to work well with other web standards, such as CSS and the DOM, and to play well with other existing and future XML-based languages, applications, and protocols.
We are mandating structural markup and forbidding presentational hacks. In XHTML 1.0 Transitional, such hacks are "deprecated," which means you can use them if you must, but you are encouraged to achieve the same design effects in other ways (for instance, by using CSS). In XHTML 1.0 and 1.1, Strict, presentational hacks are actually forbidden: Use them and your page will no longer pass muster when you run it through the W3C's Markup Validation Service.
We code with XHTML 1.0 Strict in mind but we've chosen the Transitional flavor for the following reasons:
Of the three flavors listed in the previous section, XHTML 1.0 Transitional is the one that's closest to the HTML we all know and love. That is to say, it's the only one that forgives presentational markup structures and deprecated elements and attributes.
The target attribute to the HREF link is one such bit of deprecated business. If you want linked pages to open in new windows—or even if you don't want that but your client insists—Transitional is the only XHTML DTD that lets you do so with the target attribute:
<p>Visit <a href="http://www.whatever.org" target= "_blank">whatever.org</a> in a new window.</p> <p>Visit <a href="http://www.whatever.org/" target= "bob">whatever.org</a> in a named new window.</p>
To open linked pages in new windows under XHTML 1.0 Strict, you would need to write JavaScript, and you'd also need to make sure the links work in a non-JavaScript-capable environment. Whether you should open linked pages in new windows is beside the point here. The point is that XHTML 1.0 Transitional lets you do so with a minimum of fuss.
XHTML 1.0 Transitional also tolerates background colors applied to table cells and other such stuff you really ought to do with CSS instead of in your markup. If your DOCTYPE declaration states that you've written XHTML 1.0 Strict but your page includes the deprecated bgcolor attribute, validation services will flag it as an error, and some compliant browsers will ignore it (that is, they will not display the background color). By contrast, if you declare that you're following the XHTML 1.0 Transitional DTD, bgcolor will not be marked as an error, and browsers will honor it instead of ignoring it.