Can you explain when i should use XHTML over HTML?
It's fine to use either, in most cases. It's rare that anyone uses true XHTML anyway, because it doesn't work in IE8 and under. For most websites, you have to serve your content as text/html, meaning that the doctype is irrelevant. XHTML has stricter rules, but that doesn't mean you can't follow those rules anyway.
Thanks for your responce.
Some of your statements seem contradictory.
I don't see how XHTML 5 is going to be displaced when it is being developed in parallel with HTML 5. Whatever you can do with HTML 5 can also be done with XHTML 5 (since IE8 doesn't really support either).
Just my personal prediction, but for the foreseeable future, I don't think the XHTML mime type is going to become at all popular.
mhhh... i always thought xHTML couldn't be descripted as a product, it's just a way of using HTML in the correct way and in a structured way. Why wouldn't xHTML work in Explorer 8? it works fine here...
MSIE 8.0 doesn't support the recommended X(HT)ML MIME 'application/xhtml+xml' media type [RFC3236], which is the primary media type for XHTML Family documents. Thus IE 8.0 doesn't understand XHTML and just treats the markup grammar as if it were HTML not XHTML under 'text/html'. If the author served the XHTML as 'application/xhtml+xml' IE 8.0 would ask you to download the file, it wouldn't display... Furthermore XHTML is an application of XML thus requires well-formedness or will use draconian error handling via a XML Processor and halt on none well-formed markup errors.
It only works if servered up as text/html, which means it's not actually XHTML anyway. If you serve it up as application/xhtml+xml. it won't work in IE8 and under. It was still recommended because the XHTML rules encouraged more tidy coding.
A real XHTML document would start with something like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML <font color='"#FF0000"'>1.1</font>//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr">
<meta http-equiv="Content-Type" content="<font color='"#FF0000"'>application/xhtml+xml</font>; charset=utf-8" />
More details here: http://www.sitepoint.com/forums/showthread.php?320391-XHTML1-0-vs-XHTML-1-1
and here: http://www.sitepoint.com/forums/showthread.php?393445-XHTML-vs-HTML-FAQ
No, it shouldn't.
Ralph, it probably should be more like the following if using XHTML 1.0 Strict:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html <font color='#ff0066'>[B]xmlns="http://www.w3.org/1999/xhtml[/B]</font>">
You cannot really set the MIME type with META when sending to a XML Parser. Think back to the 'purposely malformed' code demo samples I wrote: Spot the Error 3: Calling all Sleuths! and the comments I made in the Judge Feedback.
This topic is now closed. New replies are no longer allowed.