I'm sure you've heard people mumbling about XHTML and how it combines HTML and XML to create the "next generation" of HTML. I too had heard the mumbling, but actually had no idea what XHTML was... up until about 2 months ago. In this article, Mitchell gives us a quick run down of what XHTML is, some of its benefits, how it can be used, and what it looks like. He wraps up the article with a couple of XHTML examples.
XHTML documents have three parts: the DOCTYPE (which contains the DTD declaration), the head and the body. To create web pages that properly conform to the XHTML 1.0 standard, each page must include a DTD declaration; either strict, transitional, or frameset. Each of the three DTD’s is described (with an example) below:
You should use the strict DTD when your XHTML pages will be marked up cleanly, free of presentational clutter. You use the strict DTD together with cascading style sheets, because it doesn’t allow attributes like "bgcolor" to be set for the <body> tag, etc.
The transitional DTD should be used when you need to take advantage of the presentational features that are available through HTML. You should also use the transitional DTD when you want to support older browsers that don’t have built-in support for cascading style sheets.
It should be fairly obvious which DTD declaration to include in your XHTML file simply by just reading the features of each one. Now that we've got all of the formal details of XHTML out of the way, let's look at some examples of XHTML.