Web browsers are forgiving of sloppy HTML, but XHTML (being an XML application) requires fastidious attention to every detail. These requirements were outlined briefly in the XML chapter (Chapter 30), but we’ll go over them in this section as they relate specifically to XHTML.
In XML, all tags and attributes are
case-sensitive, which means that
<IMG> are parsed as different elements. In
the reformulation of HTML into XHTML, all elements were interpreted
to be lowercase. When writing XHTML documents (and their associated
style sheets), be sure that all tags and attributes are written in
If you want to convert the upper- and mixed-case tags in an existing HTML file to well-formed, all-lowercase tags, try the Tidy utility (mentioned previously) or Barebones Software BBEdit (Macintosh only), which can automate the process.
XHTML requires that all attribute values be contained in double quotation marks. So where previously it was okay to omit the quotes around single words and numeric values, now you need to be careful that every value is quoted.
In HTML, it is okay to omit the end tags for many block elements
<li>) because the browser is smart enough to
close a block element when the next one begins. Not so in XHTML. In
order to be well-formed, every container element must have its end
tag, or it registers as an error and renders the document