Now blogging at dkeithrobinson.com | Good Stuff: Web Hosting by Dreamhost

XHTML 1.0 Strict Not Ready For Prime Time?

April 28, 2004 | Comments 58 Comments

Over the last year or so I’ve started out many of my projects coding for the XHTML 1.0 Strict doctype.  I did this because I felt it was in my best interest to push the standards and go with the latest and greatest.  Now that I look back, this might have been a wee bit premature.  Why?

Because in just about all of them I end up switching to XHTML 1.0 Transitional.

It’s not because I need to use tables or anything like that.  No, it’s not that simple. It’s just that when I’m coding under XHTML 1.0 Strict things don’t seem to display correctly as I think they should cross-browser.  I can usually only get one browser to display correctly at a time.

For example, yesterday I was working on a design that needed to have two divs stacked vertically with a five pixel border between them.  These divs were coded like this:

#top {margin:0; padding:0; border-bottom:5px #fff solid;}

#bottom {margin:0; padding:0;}

Update: For those problem-solvers out there, and there seems to be quite a few, bless ‘em, I’ve posted a couple of simple files that recreate one of the problems I’m talking about.

It’s not exactly the same, but there is a gap between the content and images in Mozilla (and Safari) on the Strict example that is not there in IE. They both use the same code, they both validate, but the display in Mozilla is a bit different:

Now to me that says there should be nothing separating those divs than a five pixel border.  Well, when the document is using the Strict doctype there is a five pixel gap between them in Mozilla as well.  Fix that and it’s broken in IE.

Why is that?  If I switch the doctype to Transitional it displays properly as I think it should.

This wasn’t the only issue I came across yesterday when trying to work with Strict.  I had four other, very minor cross-browser display issues that all simply disappeared when I switched to Transitional.  I can’t say I was all that surprised, but to me that says something about how the Strict doctype is supported.

Now I’m no Dave Shea or Eric Meyer, but I think I’ve got a pretty good handle on CSS.  I do not know all there is to know and am by no means an expert on the different doctypes and how they are supported.  What I do know is that, from a practical, real world standpoint, I’d not recommend working with Strict to anyone anymore. I’ve spent quite a bit of time trying to muck with it and found it (or at lease browser support of it) wanting.

I feel that, with many in the Web standards community, there is an all or nothing approach.  That is just silly, considering the current state of browser support, and I think those “in the know” would back me up on this.  Going 100% tableless, having a 100% valid site, going Strict — these things might not even be good things to strive for depending on your project and your knowledge of CSS.

I could blame it on my lack of CSS know how, but I think I’d rather blame it on Microsoft.  I’ve got enough problems trying to get things to display correctly in IE under the Transitional doctype, let alone moving to Strict.  It can be done, but in my experience it usually takes quite a bit more work and can result in some pretty big headaches.

Why bother with it when Transitional works just fine?

Filed under: Web Development

Comments

1. Ethan said:

Hey, Keith: mind posting a bit more code, so we get some context for #top and #bottom?

For what it’s worth, I use XHTML 1.0 Strict or 1.1 for my professional gigs. I’m not pimping one DOCTYPE over another (or suggesting that you /need/ to switch to Strict), but just saying that I’ve not found IE to be less problematic in one DTD than in another.

Posted on April 28, 2004 11:29 AM | #

2. Dave S. said:

Well, I’m no Eric Meyer, but is it possible you’re struggling against margin collapsing? The elements within each div may be affecting their positioning.

Andy Budd describes it in detail.

Posted on April 28, 2004 11:32 AM | #

3. Yvonne said:

I tend to use Transitional on client sites primarily because they may end up being edited by others that aren’t as careful as I am re markup (regrettably, the primary other is my employer).

On personal projects, I usually use strict, just to train myself not to get sloppy.

Posted on April 28, 2004 11:38 AM | #

4. Keith said:

Ethan – I’ve actaully got it worked out to my satisfaction, so there is no need, but thanks for suggesting. I think this really depends on the project and it just seems like when I try 1.0 Strict (or 1.1) I seem to run into all sorts of issues that go away when I switch to Transitional.

Dave – Could very well have been. I did think of that and actually looked up that post (it was hard to find – a better title would have helped, heh) but I still couldn’t resolve it.

Thing is I had a few (all minor) issues that were all sorted out when I tried switching the doctype. Got me to thinking what the benefit was of using Strict….

Posted on April 28, 2004 11:38 AM | #

5. James Craig said:

I don’t ever recommend Transitional anymore, but I sometimes recommend HTML 4.01 Strict instead of XHTML 1.0 Strict.

Posted on April 28, 2004 12:05 PM | #

6. Andrew said:

Keith, I can’t repro your problem on any browser based on the code sample you included. (And in fact in the past when migrating a site from Trans to Strict have not seen similar problems.) Sure there was no “user error” somewhere else here? ;-)

Is it possible you were actually switching between a (valid) Transitional doctype setting and some simple typo of the Doctype tag? If you fat-fingered it when you thought you were “setting it to Strict”, you *might* have accidentally messed up the tag sufficiently to put the browsers in Quirks mode, thus the rendering differences.

In other words, did you validate your code when you had the Strict doctype in place? (Although even Quirks mode doesn’t display the specific problem you describe above in isolation.)

Posted on April 28, 2004 12:07 PM | #

7. Kyle Fox said:

So what are the benefits (if any) of using strict? Is it because it keeps your code more true to the way it’s supposed to work?

If that is the case, then doesn’t the whole “browser support” deal throw a pretty huge wrench int the works and negate that benefit?

I use Trans, but then again, I still use tables for some things.

Posted on April 28, 2004 12:10 PM | #

8. Bruce said:

I generally use XHTML Strict and don’t find I have any more problems with it than with any other DOCTYPE. IE has a few bugs with it but they tend in my experience to affect Transitional too.

Posted on April 28, 2004 12:12 PM | #

9. Keith said:

Andrew – yeah, that’s my bad for not including the whole bit of code. Unfortunately it’s changed since so you’ll have to take my word for it. Oh, and the validator was the first place I went to try and sort it out.

I’m pretty sure it was something within those divs, but even when I stripped them down I was getting the gap.

As far as I could tell, there was no reason for that gap that I could find. None. Not within, not without, nowhere. I tinkered with it for quite awhile before switching to Transitional. This is something I’ve resorted to a few times and it got me to question why I was even bothering with Strict.

I guess that is the bottom line.

There is a line where practicality and standards meet and this was it. I could have figured it out, but I’m on a short timeline and transitional works just fine…

My question to every one is – what is the benefit of using Strict (or 1.1 for that matter) in real world terms? I know all the future and theoretical benefits, but for projects on the Web in 2004, what’s the point?

I’m not knocking Strict really, I have used it and will probably continue to, but why? I want to understand for myself and share that with others. If there is no good reason (I imagine there is, I just can’t think of it) than I’d like to know that as well.

I wrote this post thinking about the thousands of Web developers who are just taking the jump into CSS and Web standards and those that are having a hard time adjusting.

The doctype differences are a bit of a mystery, even to me and I’ve as yet been unable to find an answer to the question of why Strict is better than Transitional.

Posted on April 28, 2004 12:21 PM | #

10. Keith said:

I also should point out that when I’ve come up against these issues it’s usually been with very complicated CSS only layouts. That’s why it can be a bit hard to isolate the code and the reason for my lame code example.

I ran into a similar issue with Asterisk* – don’t remember the details, but this site started out using 1.1 and I ended up switching to 1.0 because of an unresolved issue in IE.

Posted on April 28, 2004 12:29 PM | #

11. Ethan said:

I know all the future and theoretical benefits, but for projects on the Web in 2004, what’s the point?

I’m not sure you can separate the “future and theoretical benefits” with the practical ones. That is, I guess the quick-and-dirty rebuttal would be that the web of 2004 is eventually going to have to deal with the Web of 2010.

Of course, now that I’ve wandered out onto this limb, I’m not sure what the hell else to say. ;) But what happens when the user agents a few years down the road are a lot more demanding about the separation of style from content?

Hey, I brought my own straw men to the party. I rock.

Posted on April 28, 2004 12:42 PM | #

12. Anne said:

I ran into a similar issue with Asterisk* — don’t remember the details, but this site started out using 1.1 and I ended up switching to 1.0 because of an unresolved issue in IE.

There isn’t a realy difference between the two actually. See also: http://www.hut.fi/u/hsivonen/doctype.html

Posted on April 28, 2004 01:15 PM | #

13. James Craig said:

Kyle Fox said:

So what are the benefits (if any) of using strict?

The benefit is mainly enforcement of strict separation of content from style. For example, bgcolor, align, border, and other presentational attributes are allowed in Transitional, but not in Strict.

Posted on April 28, 2004 01:32 PM | #

14. Keith said:

Ethan – I get you. And you are right. BUT – in 2010 we’ll probably on to something completely different. And hey, I’ve got lots of time to upgrade. When you look at the Web as a whole, I’m WAY ahead of the game.

Anne – I thought that Strict doesn’t allow certain tags and elements? Am I wrong? “Target=_blank” comes to mind…I had to go to transitional because I needed (wanted) to use that once. The display was fine, but it no longer validated Strict.

There has to be some kind of rendering difference because when I switch to Transitional a whole bunch of issues get resolved.

Posted on April 28, 2004 01:33 PM | #

15. James Craig said:

Keith, as for your target=”_blank” usage, why not implement a script feature for that? I use popups in XHTML 1.1, but never the target attribute. Seems like you could even make it as simple as an additional class, cascade, or match on off-site URLs. Popups are better suited to scripts just as presentation is better suited to style sheets.

Posted on April 28, 2004 01:45 PM | #

16. Keith said:

James – As far as pop-ups, yeah, that would have been a good idea, but I was moving a site where target=”_blank” was all over in the content (which I did not code myself).

It would have been very impractical to go though and try to fix that. Ideally what you suggest would have been great, but in this case, I fixed the “problem” (if validation is a problem) by simply switching to Transitional.

As far as “enforcement of strict separation of content from style” being a benefit, I think you could debate that one. I mean, if I’ve got to spend another 5 hours on a project that’s already over budget I think I can live without that benefit. ;) But I agree that is one good reason.

Posted on April 28, 2004 01:53 PM | #

17. Keith said:

I’ve quickly recreated an example of one of the issues I was having. This particular problem is a display issue in Safari and Mozilla:

Posted on April 28, 2004 02:25 PM | #

18. Minz Meyer said:

Keith, I think this is because in Strict Doctypes the images’ bottom edge is aligned with the baseline of the line box!

You can now either adjust that with vertical-align or in your case maybe better (since you have no text at all) to use line-height: 0;

That closed the gap in Mozilla.

Eric Meyer has written about this 2 years ago. It’s an interesting read, and it’s here:

http://devedge.netscape.com/viewsource/2002/img-table/

Posted on April 28, 2004 02:37 PM | #

19. Doug said:

Well, in the time I wrote this, Keith already posted code samples, and Minz found the culprit immediately. As others suspected, it was something inside the divs (in this case, an inline img element) that was causing the extra gap. Here’s my comment anyway on the value of Strict over Transitional (when it’s appropriate and usable)…

I don’t have any experience with XHTML 1.1, but whenever I’ve helped get a site started with coding, I always push for the Strict version of XHTML 1.0 first. From my perspective, using Strict gives you a more confined set of rules to play with. When dropping down to Transitional, the validator will still check for XML well-formedness, but it simply gets more lax on checking acceptable elements and attributes. There’s nothing wrong with using the Transitional doctype per se, but I always want to be able to catch (and usually want the client to catch too) where I/we may have accidentally used elements or attributes which shouldn’t be there.

Jumping down to Transitional is a last resort for me – and that’s only if some element or attribute must be used (or already exists throughout the code, as Keith alludes to in his case). When we were building Wired News, it originally used the Strict doctype. But we had to use certain attributes on iframes that pulled in the ads, requiring us to drop back to Transitional to keep the code valid. As we all know, validation isn’t the end game, but we were raked over the coals the first few hours after launch because Wired News wasn’t completely valid yet. Imagine if we had been rigid about sticking to the Strict doctype – WN never would have acheived valid status.

It’s debatable whether or not target should be allowable in XHTML. That’s off-topic here. But the other odd omission, IMO, from XHTML is the deprecated start attribute for ordered lists. It’s highly useful when breaking up pages of search results, etc., and doesn’t make any sense why it should be deprecated and only allowable within XHTML Transitional. So sites that want to use ordered lists for search results are stuck with Transitional doctypes no matter what.

Back to Keith’s original issue: The weird thing is, I’ve never seen any differences in layout or rendering when switching from Strict to Transitional within XHTML though. HTML 4? Yes, because Quirks mode is triggered for HTML 4 Transitional (without the system ID). But not XHTML. I couldn’t reproduce the gap issue Keith is talking about and no longer need to now the problem has been (should be?) solved.

So hopefully, Keith, you won’t discount Strict so quickly, and you see some of the reasons for using it, if possible.

Posted on April 28, 2004 02:52 PM | #

20. Rimantas said:

oh, this is easy. Images being inline element by default and the infamous ‘mysterious gap’.

Meyer talked about it, Zeldman too: Better Living Through XHTML.

I don’t believe you did not know this, it must be just one of those days…

Posted on April 28, 2004 03:00 PM | #

21. Keith said:

Ok, so we solved the problem. This was one of four that I resolved simply by changing the doctype. And, yes, I knew it was something easy (although I’ve never come across the “mysterious gap” before I don’t think, maybe I should count myself lucky) – although it still seems like a kind of a hack to fix. Anyone else see that? To me there should be no gap to begin with…

Still, even though Doug presented some compelling arguments for Strict, I can’t say I’m really convinced it’s worth it. And I thought long and hard before I decided to even question it.

I don’t like hacks or tricks and there is so much I need to keep track of I can’t be bothered to remember every little trick needed to get things to display right.

Posted on April 28, 2004 03:12 PM | #

22. CSS Dude said:

Come on! I’ve been reading this site for 2 days now and all I can see is a bunch of laziness and whining! This is so easy, I mean, really, do you know CSS at ALL?! Everyone knows this.

You seem like a very lazy developer to me. If something is too hard you bail and turn to your blog to bitch about it. Getting things to display in CSS right can be hard, and validating can be hard, but you need to do it – it’s the right thing to do.

I’m sick of all these socalled “gurus” and “experts” whining about issues like this. Especially when they are do easy. And you call yourself a professional Web desinger…whatever bro.

Get with it man…nobody feels sorry for you. I’ve been doind CSS for less than a year and I know this stuff. Sheesh. Strict is the only way to go for a professional….

Posted on April 28, 2004 03:23 PM | #

23. zinckiwi said:

“Dude”… the best solution for the problem at hand is the only way to go for a professional.

Posted on April 28, 2004 03:42 PM | #

24. Keith said:

Dude, I’m going to leave your comment up for laughs. You imply that I’m lazy, which has to be the funniest thing I’ve heard in quite awhile.

Keep on rockin, CSS Dude, I’ll just follow along in your shadow.

Posted on April 28, 2004 04:24 PM | #

25. Ethan said:

Dude, that Keith kid is always looking to cut corners. One of the sloppiest coders on the web. I’m always having to bail him out of one jam after another.

</sarcasm>

Get real, man.

Posted on April 28, 2004 04:54 PM | #

26. Long said:

Hey CSS Dude, what the f**k is a “Web desinger” ??

Posted on April 28, 2004 05:02 PM | #

27. Peter Zignego said:

Dude, I’m sure that you impress alot of clients with your spelling and grammar.

Though, Keith, I really do pity you. From now on, you’ll always have to live in the shadow of Dude’s obvious skills. And they’re obviously way better than yours. Less than a year, and he already owns you…imagine what another year will do for him!

Maybe another rock will hit him, and he’ll come back down to earth.

Posted on April 28, 2004 05:13 PM | #

28. Jon said:

Ah, where to begin? Many others have already talked about the specific “gap” issue. But there is something else at work here as well.

First, XHTML 1.0 documents should be served with the mime type application/xhtml+xml, not text/html. You are allowed the latter but encouraged to do the former. It is easy to do if you have access to httpd.conf or .htaccess. Visit the WaSP to learn more. XHTML 1.1 requires application/xhtml+xml.

And then there are the Gecko-based browsers (Mozilla, Firefox, Camino, etc.) They have multiple levels of quirks and standards compliance modes. Each mode renders in slightly different ways.

Try authoring a page as XHTML 1.0 Strict or XHTML 1.1 and be sure to serve it as application/xhtml+xml. You’ll find some interesting surprises. Things behave differently.

IE, of course, doesn’t get application/xhtml+xml. It will try to serve the raw source as plaintext. Fully standards-compliant browsers treat properly typed XHTML as an XML document and they will parse it accordingly.

Posted on April 28, 2004 06:12 PM | #

29. Tristan Louis said:

Why even bother with XHTML 1.0 these days? Why not just go to 1.1 STRICT? I’ve done it with my site and found it to actually be rendering better than under XHTML 1.0 STRICT

Posted on April 28, 2004 06:22 PM | #

30. Jon said:

Tristan, I’ll assume you mean XHTML 1.1. There is no “XHTML 1.1 Strict”. The “Strict” is redundant.

Posted on April 28, 2004 06:42 PM | #

31. Keith said:

Jon – I don’t even want to get into the whole mime type issue, which to me is kind of irrelevent (while interesting and worth following) for anyone who needs to support IE.

Bare with me here, and correct me if I’m way off. We’re really stretching my knowledge of these things here.

I looked at Tristan’s pages (XHTML 1.1) and he doesn’t seem to be serving any mime type. So, depending on you definition, it’s not really “required” as it seems to render all right.

Then I happened to notice he’s (I think) throwing IE into quirksmode. Now I don’t have IE right now so I don’t know how it displays, I image correctly, but isn’t this just yet another hack.

I think the bottom line in all of this is that as long as we have to deal with IE in it’s current state we’ll need to resort to hacks. These can be a number of things from tables, to a transitional doctype to forcing quirksmode.

When you’re talking about hacks is one really that much better than another?

Posted on April 28, 2004 06:57 PM | #

32. Chris Vincent said:

Thanks for your input, CSS Dude! And thanks for showing us all your wonderful skills at the website you linked to! I sure do hate anonymity, even from people who post such insight as yours.

So, how old are you? 13?

Posted on April 28, 2004 07:11 PM | #

33. Jon said:

I wouldn’t say mime types are irrelevant. They exist so that user agents know how to best handle files. The specs say we should provide the correct mime type to user agents that understand it and text/html to those that don’t.

Tristan is serving the correct mime type for browsers that understand it.

IE falls into quirks mode if you look at it funny.

We’ll always have hacks.

Posted on April 28, 2004 07:16 PM | #

34. Wayne said:

“Why even bother with XHTML 1.0 these days? Why not just go to 1.1 STRICT?”

Primarily because the docs state that you MUST serve XHTML 1.1 documents as application/xhtml+xml, which chokes Internet Explorer. That’s a SHOULD for XHTML 1.0 Strict, a MUST for XHTML 1.1. More here: “What You Should Know about XHTML 1.1.”

I haven’t personally noticed any major rendering differences between XHTML 1.0 Strict and Transitional, but the fact that IE won’t even try to display properly served XHTML 1.1 docs would make “rendering differences” an understatement.

Posted on April 29, 2004 12:44 AM | #

35. Richard@Home said:

Great article as usual Keith but I heartily recommend getting the MIME type right - I fell foul of this myself ( link ) when I was dipping my toe in the murky waters of XHTML.

And BOY, do I wish CSS Dude had posted a link to some of his ‘work’! What an education THAT would be ;-)

Posted on April 29, 2004 02:31 AM | #

36. Lars said:

Keith, speaking of hacks, did you try combining the Strict doctyype with throwinng IE into quirks mode (by including the XML prologue)?

I’m sorry not to have any examplees, but last year I mmaaddee a couple of tteesst caaes which resulted in somme interestingg findings. It even helped me rreessoollvvee a couple of issues on my weblog, which has deliberately and haappiily throwed IE into quirks mode ever since.

P.S. ssorry forr the multiple letters - they came with the nighhtly Firefox build I’m using, and since I’m on a dialup I can’t be botheered to donwwload a better build, buut it’s not suppossed to make anyy difference in understanding…:)

Posted on April 29, 2004 03:56 AM | #

37. Lars said:

Forgot to say that I recommmend Wayne’s excelllentt XHTTML 1.1 roundup (see comment couple of posts up).

I alsoo agree with Jon and Richard that MIME tyypes are relevant, allthough you wouldn’t want to serve contennt aas application/xhtml+xml unless yoou have ccomplete conttrol over the markup, seeing as anythinng bbuutt 100% well-formed markup wil break in Gecko engines.

Which if you ask me is a silly Geecko “feature” (or unncessearily anal innterpretation of the specs, if you prefer).

Posted on April 29, 2004 04:08 AM | #

38. Richard@Home said:

I don’t know about unnecessary OR anal - its the fastest way I’ve found to test my pages are valid XHTML.

Nothing makes me scurry off to my home grown CMS quicker than a “Fawn Screen Of Death” (FSOD) in mozilla :-D

Posted on April 29, 2004 06:41 AM | #

39. Tristan Louis said:

Jon said:

Tristan, I’ll assume you mean XHTML 1.1. There is no “XHTML 1.1 Strict”. The “Strict” is redundant.

Correct. I did mean XHTML 1.1 :)

Posted on April 29, 2004 08:29 AM | #

40. Tristan Louis said:

I looked at Tristan’s pages (XHTML 1.1) and he doesn’t seem to be serving any mime type. So, depending on you definition, it’s not really “required” as it seems to render all right.

Actually, I do serve a mime-type, based on what the browser can handle. This is done through a quick php check. The code is as follows:

if (stristr($_SERVER[“HTTP_ACCEPT”],”application/xhtml+xml”))

{

header(“Content-type: application/xhtml+xml”);

}

else

{

header(“Content-type: text/html”);

}

That way I can serve both the IE and compliant audiences.

Then I happened to notice he’s (I think) throwing IE into quirksmode. Now I don’t have IE right now so I don’t know how it displays, I image correctly, but isn’t this just yet another hack.

I guess technically, it is but considering how quirky IE is, it’s a relatively small hack (not to mention that I also have a different CSS being served to IE users.

When you’re talking about hacks is one really that much better than another?

As a general rule, I try to hack the code in a way where the XHTML and/or HTML is no different whether it’s IE or other browser. I even try to hack the code so that the stylesheets are clean and independent. That way, by sequestering the "quirky" browsers, I can still produce clean code and eventually (if ever) drop support for the quirks when Microsoft finally agrees to standard compliance.

Posted on April 29, 2004 08:46 AM | #

41. Keith said:

Good enough, thanks for the explaination Tristan. Lots of this is a bit over my head, but it’s interesting – I’m really just a simple Web designer most of the time! ;)

Posted on April 29, 2004 09:34 AM | #

42. Wayne said:

“As a general rule, I try to hack the code in a way where the XHTML and/or HTML is no different whether it’s IE or other browser.”

In my experience this isn’t really that hard when you’re dealing with most versions of XHTML. Even if you decide to serve the document with different MIME types to different browsers you shouldn’t need to modify anything in the XHTML source.

But it’s not true of XHTML 1.1. The MIME type gets in the way. I said:

“Primarily because the docs state that you MUST serve XHTML 1.1 documents as application/xhtml+xml, which chokes Internet Explorer. That’s a SHOULD for XHTML 1.0 Strict, a MUST for XHTML 1.1.”

But that’s not exactly true. What the docs say specifically is that all versions of XHTML SHOULD be served as application/xhtml+xml, but you MAY serve eveything but XHTML 1.1 as text/html. It’s not exactly a MUST, but there’s a clear implication that it’s fine in a crunch to send XHTML as text/html, but not if it’s XHTML 1.1.

Source.

So, your choices are as follows:

  • Use XHTML 1.1, but serve separate XHTML 1.0 (or some version of HTML) documents to IE and its ilk.
  • Use XHTML 1.1 and forget about IE and most of your audience.
  • Don’t use XHTML 1.1 at all.
  • As far as I can tell, anything but one of those three puts you out of conformance.

    Posted on April 29, 2004 11:36 AM | #

    43. Lars said:

    Richard, weelll-formmednness aand validity are noot the same thing.

    Geckoo-enginneess will display invalid markup as long as it is welll-formed.

    Keith, I thought you were a “web desinger”. I’m confused….

    Posted on April 29, 2004 11:59 AM | #

    44. Patrick said:

    Wayne, I’ve been struggling with this XHTML 1.1 and application/xhtml+xml issue, and your statements are confusing me more. I have been under the impression that XHTML 1.1 documents MUST be served using application/xhtml+xml, and MUST NOT be served using text/html, and this seems to be what you’re saying:

    you MAY serve eveything but XHTML 1.1 as text/html

    But, reading the document that you (and everyone else) quote on the issue, I see that the document actually says SHOULD and SHOULD NOT.

    So, while I have reached the same conclusion that you have (i.e., that I should not be writing XHTML 1.1 unless I can ensure that my documents will be served with application/xhtml+xml), I find myself unable to solidly justify this decision to others in my company who want us to adopt XHTML 1.1 as our standard. They point out that the W3C explicitly defines “SHOULD NOT” as meaning what you’d expect it to mean, which is that if they say you SHOULD NOT do something but you do it anyway, you are still technically in conformance with the letter of their recommendation (although, obviously, not the spirit). This would seem to lead to the conclusion that serving XHTML 1.1 as text/html is still technically allowable under the W3C recommendation.

    If anyone has more supporting documentation that would help me make a case for not serving XHTML 1.1 with text/html, it would really help me out.

    Posted on April 29, 2004 02:35 PM | #

    45. Andy Smith said:

    Keith said:

    To me there should be no gap to begin with…

    The reason for the gap is explained in this article on Netscape DevEdge. I think it makes sense when you read it, and it’s necessary to get images to display where you’d probably expect if you put them next to text. Unfortunately it breaks most table-based layouts which is why it doesn’t appear in quirks mode.

    The problem with strict vs transitional is that a transitional doctype makes Mozilla go into “almost standards” mode. Apart from the gap thing, I don’t think there’s much difference between standards and almost standardards modes.

    Andy

    Posted on April 30, 2004 04:46 AM | #

    46. Wayne Burkett said:

    You’re right, Patrick. This is a pretty complicated issue, but it essentially breaks down like this:

    Regarding XHTML 1.0 the W3C says you SHOULD use application/xhtml+xml, but MAY use text/html – and here’s an important part that’s often left out – if your document conforms with the HTML backwards compatibility guidelines set forth in Appendix C of the XHTML spec.

    If, however, your documents aren’t backwards compatible, or if they’re written using XHTML 1.1, the docs say you SHOULD use application/xhtml+xml and SHOULD NOT use text/html.

    So, you’re absolutely right: the only thing that changed is that the MAY use text/html became SHOULD NOT use text/html.

    Those of us who think it’s pretty much evil to serve XHTML 1.1 as text/html have often made the mistake brushing aside the equivocality you cite.

    There’s room for some argument, though, over whether technical conformance is more important than following the spirit of the docs.

    Posted on April 30, 2004 08:59 AM | #

    47. sergio said:

    I’m guilty of the _blank stuff myself, so I use 1.0 Transitional. Another think that makes me wary of Strict is how firefox chokes up on it when it doesn’t validate. Lars has an excellently looking site but has had entries crash and burn because of inappropriate html in the comments. It doesn’t look pretty in Firefox (actually, it doesn’t look like anything at all – just an error message).

    I think Strict is cool, but I’ll wait for another two browser iterations before I try to code everything with it.

    Oh, and CSS Dude is the greatest. I mean, the guy’s nickname is CSS Dude, for crying outloud! He must be like… a lesser CSS God or something.

    Posted on April 30, 2004 01:10 PM | #

    48. Lars said:

    Sergio, how dare you?!?

    He. Actually, Sergio speaks the truth.

    “Crash! Burn!” my entries went. But I maintain that it’s a browser flaw, in the best Microsoft spirit (the one where applications try to outsmart their users). I know there have been long, religious discussions on whether or not this is good or evil, and I guess that such a discussion is better left to those forums.

    My point here is that, uh, what I meean is that my point is…eh…oh oops damn browser crashed in the middle of writing this comment…how unfortunate!

    Posted on May 1, 2004 04:21 AM | #

    49. Bryan said:

    Wow, interesting post. I, myself, have wanted to understand the key differences between strict and transitional.

    I use transitional on all my sites because for me, right now, its the easiest as I do my best to learn the separation of content and presentation. Plus, I occasionally still use tables for certain things.

    I am curious about using the _blank attribute. Many of you say to use POP UPS instead. I am assuming you mean using javascript to create this effect? If so, could you post some resources of solid standards compliant popup scripts. I am actually surprised that _blank isn’t recommended since it works in most browsers with javascript turned off, right? So going with a javascript popup I would think could be a hassle to users. Please provide more information.

    btw - Keith, great website.

    oh, and CSS DUDE. You are my hero. You got some mad skills, too bad you didn’t post your email address you Anonymous Little Bitch. If you want to stand tall, back up your comments. If you think Keith sucks at his job, then show us what you can do better.

    Posted on May 3, 2004 06:36 AM | #

    50. Tanny O'Haley said:

    Okay Brian, here’s an article on Accessible Pop-up Links at A List Apart.

    Posted on May 4, 2004 09:12 PM | #

    51. Laurens Holst said:

    James — As far as pop-ups, yeah, that would have been a good idea, but I was moving a site where target=”_blank” was all over in the content (which I did not code myself).

    It would have been very impractical to go though and try to fix that. Ideally what you suggest would have been great, but in this case, I fixed the “problem” (if validation is a problem) by simply switching to Transitional.

    Ahum. May I point you to the fact that that is the whole *point* of Transitional? The name says it all. It is meant as a Transitional document type for moving ‘old’ format to the ‘new’ preferred format.

    ~Grauw

    Posted on May 5, 2004 10:26 AM | #

    52. Yushi said:

    XHTML is perfectly ready. IE isn’t because they stopped its development.

    Go with other browsers and tell that the world.

    Posted on May 5, 2004 10:53 PM | #

    53. Derek Pennycuff said:

    Standards are great for the way they make our jobs easier and keep us from having to redesign with every new browser release. They aren’t great simply because they are new. In fact, most of the technologies people speak of when they use the term “standards” aren’t new at all. Full or at least decent support for them in common browsers is pretty new. So the standards movment doesn’t need to align itself with the idea of being on the bleeding edge of emerging technologies. And in fact it doesn’t, although that’s an easy thought trap for designers to fall into. Browsers should support standards in a timely fashion. But it doesn’t matter how valid the code is if current browsers don’t properly support it. I’ve had simular issues with trying to use xhtml strict. I’ve had little to no troule using the transistional flavor. Spotty browser support for the xhtml strict standard is the only reasonable explanation I can come up with. So I too have strayed away from trying to use xhtml strict for a while. For the same reasons I didn’t try to do pure css layouts back when IE 5 was the newest thing on the market. I’ve seen no documentation proving that the troubles I’ve had are caused by spotty support for xhtml strict, but it’s the only reason that makes sense to me.

    Posted on May 17, 2004 12:21 PM | #

    54. Derek Pennycuff said:

    Having read more of the comments and taking some time to reflect, I think most of my “strict” issues came up when i was actually trying to use xhtml 1.1. I admit to little more than a base knowledge of the differences in the various versions, but my initial thinking was something along the lines of “If they’ve come out with 1.1, why use 1.0 strict at all? Wouldn’t that be kinda like using HTML 4.0 instead of 4.01?” I guess that was pretty niave of me. I’m still not clear on this whole application/xhtml+xml stuff, but what it seems to be saying to me is avoid xhtml 1.1 until IE gets it’s poop together and that version (with the tegether poop) is in widespread enough to make it a viable option. Or, wait until everyone abandons the MS monopoly and starts using Mozilla or Opera or Safari or pretty much any non-Microsoft browser. Which do you think is more likely to happen first?

    Posted on May 17, 2004 12:41 PM | #

    55. Mitchell said:

    Great site and great blog on XHTML. One final point to add to some super comments that are very helpful…

    Remember, that XHTML is XML, essentially. Thats why, no matter what DOCTYPE or type of XHTML you end up serving, remember, the whole point is to make sure your pages are well-formed (no broken tags, quoted attributes, etc.) and validate as xml (have elements that are supported and not deprecated). If you do that correctly, sending both the XHTML doctype fully formed (full url) and the web server header MIME type for your pages as application/xhtml+xml or XHTML (instead of the default which is text/html), your pages should and will force you to clean up your markup messes and send pages that meet both the doctypes requirements and the xml requirements. Migration from there to future versions of xhtml are allot easier. Dont get sidetrackd by visuals in your browser or doctype switching or CSS issues related to different browsers when looking at the big picture. Those should not come first. Its your markup you are changing. Do the others last.

    If you choose to keep sending the MIME text/html for XHTML pages (required for IE), no matter what the w3c says or requires, you will SEE your designs perform ok, but just keep in the back of your mind, you are not using XHTML and not sending or seeing xml pages. Just because you have a doctype that says it, you have validated your xhtml pages at the validator.w3.org site, and use a meta tag with the mime, its still NOT XHTML you are sending. Just remember that. When you first, clean up your code, then send the mime, and finally test and validate in a conforming agent like Mozilla, and no errors are shown, then, you are on your way towards the future, my friend. All the other stuff…..like doctype switching, quirks versus standrads or almost standards mode, and which doctype is better are all secondary to making sure you send the right MIME, and take the leap and fully validate every single web page against the MIME and doctype completely. Transistional or strict or versiosn 1.1 or version 2….it doesnt matter. The whole purpose is to convert your pages to the xml medium. And to do that you have to do in correctly.
    -Mitchell

    Posted on December 28, 2004 11:30 PM | #

    56. Alex said:

    Kieth,

    I would like to share a few of my experiences with you on the great things that going with xhtml strict has done for me.

    I appreciate the fact that for updating old site projects, xhtml transitional is often a good choice. However my business has me programming many web services for them. The strict separation of code is so incredibly time saving you have no idea. Site wide changes in presentation are so much easier now that I only have to edit a stylesheet. Combine CSS with a xhtml template engine(check out XTemplate on sourceforge), managing websites becomes the easiest thing in the world.

    The code should age gracefully and interoperability with other xml services is a breeze. Also I have found that my xhtml 1.0 strict sites render perfectly on all the cellphone and pda browsers I have tried. I can’t say the same for transitional.

    xhtml strict also seems to me(IMHO) to play more nicely with scripting languages or at least feels a little more at home.

    Not to mention the good programming practice and good habits you pick up while writing xhtml strict.

    As for changing things like target= attributes to a javascript popup or something, you should learn how to use regular expressions. Some clever search and replace statements will fix you right up.

    I guess what I recommend is for any new projects you are starting, go strict all the way.

    To update existing sites, well thats up to you and transitional may be more in the budget.

    In any case, you should expect future user agents to have more comprehensive support for strict because of the demand that web developers are putting on vendors. Even giants like MS are going to have to support open standards or go home eventually.

    All of my comments are based on the benefits I have eperienced first hand and not on some open standards propoganda I’ve read somewhere.

    Home this helps you make up your mind.
    Also check out technologies like XForms(W3C) and see the exciting places that open standards are taking us.

    Regards,
    Alex

    Posted on April 9, 2005 05:20 PM | #

    57. richard said:

    Hi all, I’m experiencing some problems with my website pages not displayign correctly in some browsers, could you please tell me where I’m going wrong with my xhtml 1.0 strict coding, and where the main problems re usually found?

    cheers
    richard


    Posted on May 19, 2005 08:15 AM | #

    58. Greg said:

    Dear Keith,
    How do you see the usability of xhtml strict or 1.1 now. It’s been more than a year from your post.
    We have Zeldman’s “Designing with web standards” ;),CSS Zen Garden.
    I am a beginner so I try to use 1.1.
    I think that not DOCTYPE is the problem but the browser’s compatibility. For example, IE sometimes makes me angry (no support for :fixed, etc)
    I’m here for the first time and I like your page very much.
    Kind Regards,
    Greg

    Posted on June 9, 2005 11:35 PM | #

    Comments are now closed

    Entry Archives

    You are reading XHTML 1.0 Strict Not Ready For Prime Time? posted on April 28, 2004 and filed under Web Development.

    About the Author

    is a Web designer and developer in Seattle, Washington. More »


    7nights.com  Web


    Old Stuff: