HTML and CSS Reference
In-Depth Information
Notice that the previous example uses an .
xhtml
file extension. XHTML5 usage clearly
indicates that an HTML5 document written to XML syntax must be served with the MIME
type
application/xhtml+xml
or
application/xml
. The previous example was served
with the former MIME type. You can find the same example served with latter XML MIME
type at http://htmlref.com/ch2/xhtml5helloworld.xml.
Unfortunately, although HTML5 supports XML, the real value of XHTML—the true
strictness of XML—has not been realized, at least so far, because of a lack of browser
support. As of this edition's writing, Internet Explorer browsers (up to version 8) will not
render XHTML served with the appropriate
application/xhtml+xml
MIME type and
will take the raw XML form and render it as a parse tree. Other browsers, fortunately, don't
do this (see Figure 2-2), which is little solace given Internet Explorer's widespread usage.
You can write XMLish markup and serve it as
text/html
but it won't provide the
benefit of strict syntax conformance. In short, HTML5 certainly allows you to try to
continue applying the intent of XHTML in the hopes that someday it becomes viable.
F
IGURE
2-2 XHTML5 works, but Internet Explorer support lags.