Does anyone have any thoughts on Doctype? I originally read that it was better to start using XHTML because of future compatibility, device independence, etc. Then I read that feeding an XHTML document with a "text/html" charset was harmful, or at least would be interpreted as "tag soup" by IE. So, now I use HTML4.01 Strict as a default doctype.
At this point, is there really any advantage to using XHTML (Transitional or Strict) over HTML 4.01 Strict? If so, how are you feeding your XHTML documents? Are you using browser-sniffing to dynamically determine doctype and charset? Is it worth it?
As long as you can't figure out a point to use xhtml you obviously don't need it. But if you write good code that follows most of xml rules, then why not use xhtml (but NOT xhtml1.1 of course)? You probably won't benefit from this right now, but you get used to it.
Then I read that feeding an XHTML document with a "text/html" charset was harmful, or at least would be interpreted as "tag soup" by IE.
Well, 1- everything gets interpreted as tag soup in IE right now anyway, I believe.
And 2- only the XHTML1.1 spec specifies that it needs to be sent as content-type application+xml/xhtml anyway. XHTML 1.0 transitional and strict are both perfectly valid when sent as text/html.
The more important choice in terms of doctype is going with a strict variant over the transitional variety, mostly because you should have better treatment in rendering engines across browsers (in theory). 24 Ways has a good article up that covers the topic, Transitional vs Strict Markup.
I agree that it's the "Strict" that matters more than anything. It is my understanding that transitional doctypes are rendered in quirks mode in IE. I have better luck getting CSS to render properly across platforms with a strict doctype, therefor it's always XHTML 1.0 Strict for me.
1. It is not totally forbidden to send XHTML 1.1 documents as text/html. xhtml specification says that xhtml1.1 _SHOULD NOT_ be send with 'text/html', and "should not" according to rfc2119 mean "not recommended", "there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label".
2. XHTML code served as 'text/html' _is not_ XHTML - it is (malformed!) HTML.
3. I do not see the point in browser sniffing just for setting doctype and content-type if document is full functional as 'text/html'. Can this be useful?
Thanks for all the feedback -- but no one has produced a reason for why they use XHTML.
What would be the advantage of serving XHTML Strict documents? Are they read by more devices (ie: PDAs, smartphones, mobile phones)? What advantages do they offer over HTML 4.01 Strict documents?
If I knew that XHTML Strict documents were being rendered in more devices that would be reason enough to change over -- any thoughts?