Page 1 of 1

Doctype.

Posted: Mon Jun 18, 2007 3:48 pm
by JellyFish
How does one decide which doctype is right for him/her?

What are the benefits of each?

Which do you use?

And any other questions will follow...

EDIT:

Why doesn't everyone use XHTML doctypes?

Posted: Mon Jun 18, 2007 4:10 pm
by superdezign
Sometimes, if you want to do weird stuff, you can't use strict doctypes. The more weird stuff, the looser of a doctype you'll need.

Posted: Mon Jun 18, 2007 4:23 pm
by feyd
XHTML, in the true sense, isn't all that well supported in browsers still. On top of that, there are many instances where you want or need to use markup that isn't compatible with it.

Posted: Mon Jun 18, 2007 10:54 pm
by matthijs
You decide which doctype to use based on what you plan to do with your site. What content you will serve. You'll have to do some research on this, there isn't an easy answer to this.

A good starting point are the articles Roger Johansson wrote about the subject, like HTML vs. XHTML on standards compliant websites

Or what Anne van Kesteren writes

In short: there are no real benefits of XHTML vs HTML. It's more important to use a strict doctype vs a loose one because of the strict rendering mode of browsers. A few years back XHTML was all the hype but that has passed now people realize the disadvantages (or lack of advantages).

Posted: Mon Jun 18, 2007 11:04 pm
by The Phoenix
matthijs wrote:In short: there are no real benefits of XHTML vs HTML. It's more important to use a strict doctype vs a loose one because of the strict rendering mode of browsers. A few years back XHTML was all the hype but that has passed now people realize the disadvantages (or lack of advantages).
The first comment is inaccurate, and the second clarifies why.

There are real benefits to XHTML v. HTML, but the disadvantages are substantial.

The key benefits are related to machine parsing - easier to create, and easier to consume. The key disadvantages are unfortunately huge - incompatibility with the majority share web browser unless you take special steps to avoid it (and even then, you lose some of the benefits).

It has advantages. Large advantages. Once Microsoft fixes the XHTML+XML app issue in IE8(or later?), I predict you will see a substantial move to embrace those advantages.

In the meantime, 80% (as they say) of the advantages can be had with 0% of the disadvantages - a worthwhile compromise for most.

Posted: Mon Jun 18, 2007 11:12 pm
by Luke
hmm... very interesting matthijs. I often find myself doing something simply because "the internet told me to". I never really stopped to consider why I should or shouldn't be using xhtml. I just kind of used it when I knew I could get away with it. After about an hour of surfing your links (and related) I have decided to switch to html 4.01 Strict whenever possible and html transitional only if I really need to. Thanks! :)

Posted: Mon Jun 18, 2007 11:19 pm
by matthijs
The first comment is inaccurate, and the second clarifies why.
What I mean is there are in most cases no real - practical - advantages. And that is accurate in my opinion.
(it stays difficult to write in a non-native language..)

Ninja: indeed. I used to follow what the web guru's did. Slap on an XHTML strict doctype, put on that xhtml valid badge and think I was ok. It's only when you do some more reading you start to realize it's not that simple

For me a html4 strict doctype works fine as well.