Doctype.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Doctype.

Post 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?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post 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).
User avatar
The Phoenix
Forum Contributor
Posts: 294
Joined: Fri Oct 06, 2006 8:12 pm

Post 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.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post 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! :)
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post 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.
Post Reply