...web design...

Don't Fix Your Site With the Right DOCTYPE!

Let me start by referring to the old article on the subject over at A List Apart. If you read it, then make sure you read it well. Otherwise you may end up with one of many wrong conclusions and potentially failing outcome.

I don't know how many who have actually read that article, but I do know that many who claim they have read it, didn't get it. The result is enormous amounts of pure garbage all over the web – with the wrong DOCTYPE – claiming to be what they clearly aren't.

What most web developers/designers are looking for is a mode switch that'll make browsers switch to “standard compliant mode”. That's easy enough, as one can just copy and paste a suitable DOCTYPE into any document and get the desired effect.

Just pasting in <!DOCTYPE> at the top of a document will do just fine as mode switch in today's browsers. Can't be simpler, which is probably why the only slightly longer <!DOCTYPE html> may end up as mode switch in HTML 5. However, it won't solve any other problems a document may have, and it certainly won't make a non-valid document valid.

You can not fix anything with the “right” DOCTYPE, unless the document you have created lives up to the very same “right” DOCTYPE.

What many web developers/designers seem to ignore is that “standard compliant mode” means “treat the document as if it was created in accordance with a particular standard”, or, in other words: “treat the document as if its creator knew what he or she was doing when creating it”.

Some web developers/designers don't know what they're doing, and some don't care what they're doing. There's a world of difference between “not knowing” and “not caring”, but sadly: a failure is a failure no matter the reason, and should be dealt with.

forgive them…

Browsers do apply the programmatic equivalent of the following passage from the Holy Bible…
“Father, forgive them, for they do not know what they are doing”

The solution is called error recovery, and is daily saving billions of HTML documents consisting of nothing but pure garbage behind what appears on screens, from total failure in every single browser ever created.

Caveat: error recovery is definitely not backed up by divine powers in any browser, so what we get is “pure garbage in, and a converted batch of the same pure garbage out”. Not very reassuring.

In other words: browsers apply what's known as qualified guesswork in their error recovery process, and mix in some basic web standard rules for good measure. It is anybody's guess what ends up on screens or whatever – especially since browsers don't apply the same guesswork and hardly even the same interpretation of basic web standards.

In the end we can do nothing but forgive the browsers for not converting the garbage “perfectly right” every time, and pray for a change in wind-direction or whatever we believe may help us in our efforts. Or, we can fall back to proper use of web standards, and fix the browsers' more or less absurd bugs when they fail. It's our choice to make.

having problems…

Example: a developer/designer is having one problem with a document, and the problem is limited to one browser. Should be easy enough to debug.

However, the HTML validator reports: “Failed validation, 1275 Errors” in that one, single, document, so one has to be pretty obsessed with the art of self-punishment to even look at it twice.

Yes, the document does survive pretty well across browser-land thanks to browsers' error recovery – apart from that one problem in one browser, but its survival rely heavily on the fact that it is “fixed with the wrong DOCTYPE”. Such a “fix” was clearly not what Jeffrey Zeldman meant when he wrote his article on the subject.

The failing document is pure garbage: a messy combination of a whole number of standards and non-standards and whatnot, and no existing DOCTYPE covers that combination. Not even a well-tuned HTML Tidy can make such a document conform to any standard, so it will just churn on it a bit before simply stripping out the DOCTYPE.

I don't know of any serious web designer/developer or code-debugger who would bother to look for a specific problem in a document that fails so badly. I certainly won't.

So, if you ever consider presenting documents like that when asking for help, you shouldn't be the least surpriced when being told why we won't help you.

does a few validity-errors really matter?

The answer is: it depends. The type of errors and what DOCTYPE one chooses, may make all the difference.

  • Having valid source code doesn't guarantee a perfect result for a web design, any more than a spell-checker guarantees the quality of my writing.
  • Having non-valid source code doesn't necessarily cause breaking, same as that a few typos won't necessarily break this article.
  • Pasting the wrong DOCTYPE into a document may also work – until a browser processes the document in accordance with the standard behind the DOCTYPE you've provided.

The complete answer is that “it doesn't matter to me how many and what type of errors you have in a document's source code, as long as you don't ask me for help with it when something doesn't work as you intended”.

If you have problems, then at least fix what you can – and RTFM, before asking for help with whatever else is bugging your creation. You may end up not needing any help from others, once you've done a proper job with what you've got – and at least fixed all obvious validity-errors.

Sure, we'll help…

I do help others with (X)HTML/CSS related problems. That's part of my job, and I'm good at it. I'm also helping others for free when I have time, through a number of discussion-lists and -forums.

I don't mind helping aspiring, or more advanced, web designers getting their attempts up and running across browser-land – despite finding a few of the more innocent validity-errors in their documents. I will normally expect such errors to be fixed without unnecessary delays though – if at all possible, as any error is a potential cause for failure in the future.

Web designer, at any level, who are deliberately ignoring errors and keep on producing low quality stuff, show clearly that they don't care. I must therefore assume that they don't want to do anything right. No use wasting time on those, so I won't – paid or not.

So, the best advice I can give web designers/developers in trouble, is that they at least try to get onto the right track and produce reasonably standard compliant documents, before asking others for help. It helps.

May all standards, browsers and devine (and even some not so devine) powers be with you…

sincerely  georg; sign

Hageland 30.sep.2007
last rev: 07.oct.2007


You may end up not needing any help from others, once you've done a proper job with what you've got – and at least fixed all obvious validity-errors. — Georg

I don't mind helping aspiring, or more advanced, web designers getting their attempts up and running across browser-land – despite finding a few of the more innocent validity-errors in their documents. — Georg

basic web standards:
relevant discussion lists:

quick check-list:

A good web page should…

  1. not rely on browser's error recovery.
  2. be coded to work in accordance with its given doctype.
  3. go through proper quality control before being released into the wild.

Only this way can we find and kill those nasty browser bugs.

sign: Molly 'the cat'