deskbd — 2013-04-07T04:38:25-04:00 — #1
Can you explain when i should use XHTML over HTML?
ralphm — 2013-04-07T04:41:49-04:00 — #2
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.
deskbd — 2013-04-07T05:09:45-04:00 — #3
Thanks for your responce.
ralphm — 2013-04-09T03:08:59-04:00 — #4
Some of your statements seem contradictory.
felgall — 2013-04-09T03:18:08-04:00 — #5
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).
jeff_mott — 2013-04-09T04:10:46-04:00 — #6
Just my personal prediction, but for the foreseeable future, I don't think the XHTML mime type is going to become at all popular.
kleurplaten88 — 2013-04-12T04:56:56-04:00 — #7
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...
xhtmlcoder — 2013-04-12T05:09:48-04:00 — #8
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.
ralphm — 2013-04-12T05:13:08-04:00 — #9
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
zcorpan — 2013-04-12T05:35:19-04:00 — #10
No, it shouldn't.
xhtmlcoder — 2013-04-12T05:53:42-04:00 — #11
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.