Imagination is our power

Common doctype declarations

HTML 4.01 Strict


The HTML 4.01 Strict document type puts emphasis on structure over presentation. Deprecated elements, presentational attributes, frames, and link targets are not allowed in this doctype, and visitors utilizing older browsers may render the pages with little or no flair and varied support for style sheets.

HTML 4.01 Transitional

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

The HTML 4.01 Transitional document type declares and includes all elements and attributes of HTML 4.01 strict with additional support for presentational attributes, deprecated elements, and linking targets.

XHTML 1.0 Strict

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
This is the xml version of the HTML 4.01 Strict document type.

XHTML 1.0 Transitional

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

This is the xml version of the HTML 4.01 Transitional document type.

As you can see, the major decision points here are whether to choose between HTML and XHTML, or between strict and transitional. The decisions you make will determine which doctype you will declare inside your web documents.

Which doctype declaration should you implement?

If you start out without a doctype at all, it will throw the browser or validation tool into what is known as “Quirks” mode and the user agent will assume the page is written in an older invalid markup and code including outdated or deprecated practices. The user agent will attempt to parse and render the content in a backwards compatibility method, possibly rendering the code and CSS down to the level of IE4 or earlier and using proprietary Document Object Models (DOM’s) specific to the browser or user agent. Not exactly how you would want your web pages and documents to be rendered if you want to ensure all user experience events and interactions match with your expectations and goals.

In most web document implementations there are two main options for selecting the correct doctype, either HTML 4.01 Transitional or HTML 4.01 Strict. XHTML alone is rarely used on the web today. If you use XHTML, it should be marked up with the application/xhtml+xml MIME type. The alternative, using XHTML but delivering it as text/html, causes numerous problems that are outlined in the document entitled “Sending XHTML as text/html Considered Harmful.”

Select the HTML 4.01 Transitional doctype for an all-around, standards-compliant document that renders in most user agents and containing all the necessary elements and attributes. Consider the transitional doctype if your web pages meet the following criteria or requirements:

  • You are creating new pages and are unsure what doctype to use
  • You need your page to include tables as a means for layout and also include images inside of tables
  • The pages emphasize presentational markup
  • You need to allow external linking to open up in new browser windows

Select the HTML 4.01 Strict doctype for full standards compliance in all current browsers and user agents with new pages that contain clean, fully compliant markup and code, and combined with CSS for both presentation and positioning. Consider the strict doctype if your web pages meet the following criteria:

  • CSS is used for both layout positioning and presentation styling
  • You need to increase the accessibility of the page
  • You need to meet standards of compliance for all modern browsers
  • The page needs to render in alternate and mobile devices
  • The page will not be using presentational HTML coding

What doctype do you implement in your web documents and why?


Comments on: "Quick Tip: Selecting the right doctype" (3)

  1. What a great web log. I spend hours on the net reading blogs, about tons of various subjects. I have to first of all give praise to whoever created your theme and second of all to you for writing what i can only describe as an fabulous article. I honestly believe there is a skill to writing articles that only very few posses and honestly you got it. The combining of demonstrative and upper-class content is by all odds super rare with the astronomic amount of blogs on the cyberspace.

  2. I’ve been using:

    And it seems to work, every other doctype locks my layers and won’t allow them apsolute positioning.

  3. I’ve been using:

    !DOCTYPE html Transitional//EN
    html xmlns=’’

    (put at the end and change the ‘ for “)

    And it seems to work, every other doctype locks my layers and won’t allow them apsolute positioning

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: