// Articles / The Importance of Doctypes

Posted The: 05/03/2008 - AT: 11:09

Edited The: 11/07/2008 - AT: 9:26

Many webdesigners seam to neglect The Importance of Doctypes, some even neglect to validate their pages using The W3C Markup Validation Service.

A lot things might go wrong if we do not declare the doctype in our websites and html documents.

The Importance of Doctypes

Of course one may have their own reasons for leaving out the doctype, but reality is that it saves us a lot of work, so whatever reason you got, you will only end up making things more difficult for yourself.

Doctypes Explained

By default browsers will render website's without a doctype, in backwards compatibility mode, also known as quirks mode. The doctype works as a switch between these modes.

When we include a doctype, the browser will attempt to render the page as close to the standards as possible, this makes it easier for us to predict how our pages will behave in a given environment, User Agent, or Platform. Today most browser's, are pretty close to the standard, and as such we shouldn't encounter major difficulties regarding browser specific problems, and we should not need to use css hacks.

The Different Doctypes

Note. Below I've included a list of doctypes, which are the most popular doctypes in use. As you may know, each of these either represent their own version of html, a different derelict, or a entirely different language.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

Note. Transitional doctypes are used when, you want to include deprecated presentational attributes. Frameset is used when, you want to use frames.

Chosing the right Doctype

For beginners this may be a hard choice, many beginners will chose XHTML, since thats the "newest" and most "modern", but theres more into it then that. You shouldn't use XHTML simply to enforce the standards, or because its the "newest".

Use what you like the most, i chose to use HTML 4.01 Strict for Brugbart, and it surely gets the job done.

Do not fear old Doctypes

Older doctypes will continue to be supported for a long time, dont worry about pages suddenly stop working, or stop validating twords the doctype you are using. HTML 4.01 Strict, is still a good choice, (if not better then XHTML).

Stumble It!

Author: BlueBoden

Comments: [0]

  1. HTML Tutorial
  2. CSS Tutorial
  3. XHTML Tutorial
  4. RSS Tutorial
  5. PHP Tutorial
  6. htaccess Tutorial
  7. Server Tutorial
  8. SEO Tutorial

Checked At:06:40

10 Guests

0 Users

Online doing the past 15 Minutes!

PageRanking.dk - Flere hits og højere PageRank - GRATIS tilmelding!

This page was created in 0.124713897705 seconds

Welcome Guest