There is much debate over whether HTML or XHTML is the 'better' way to write code. First some background reading:
I won't rehash the historical reasoning (see those blog posts), but basically, it comes down to this:
text/html
by apache, IIS, etc, regardless of whether they are XHTML or HTML. This is because IE (apparently including IE 7) doesn't handle documents with content type application/xhtml+xml
, offering them up for download instead of viewing.text/html
(even if it isn't actually parsed as XML), and that XHTML (at least if it is fully valid XHTML) is cleaner, faster and more likely to be forward-compatible than standard HTML 'tag-soup'. Since browsers all interpret XHTML properly, send that instead.In my opinion, it really doesn't matter that much. I use XHTML for some projects, standard HTML for others. In practice, there is very little difference. The biggest, most important thing is to make sure you use a STRICT doctype, and not one of the transitional ones.
XHTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
As you can see on the Activating Browser Modes page, those two doctypes force standards mode rendering in as many browsers as possible. That's much more important than XHTML vs. HTML.