XHTML: Doctypes

In This Tutorial I Will:
•Explain XHTML’s special rule, Doctype.

XHTML has multiple new standards, but one of the most important is the use of a Doctype. Doctype stands for Document Type, and must be placed before the <html> tag; Doctype must be the very first bit of code on a website.

There are three different DTDs (Doctypes):
Strict

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

Use Strict DTD when you want to have precise perfect source code. Must use CSS to style the website.

Transitional

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

This is the most common DTD. Highly compatible with many browsers. Suggested use of CSS to style the website.

The last DTD is Frameset and that is used for Frames, which are now discouraged, but still legal in XHTML. Either way, don’t use them. For that reason, I am not even going to post the Frameset DTD.

You can validate your websites to see if they match the Strict or Transitional XHTML Standards by going here.

Leave a comment

Name: (Required)

eMail: (Required)

Website:

Comment: