The JMBG Logo Welcome to
The JMBG Network
colour scheme: Grey Purple Blue Green Orange Red
You are currently not logged in.
reference & tutorials   >   HTML / XHTML   >   Document Types

HTML / XHTML Document Types

Document Types

For both HTML and XHTML there are three different Document Types that you can use. Technically the Document Type should tell the browser and any validation service what kind of document you've wrote. It is important that you do use the correct one for what you are doing. The document type is commonly refered to as DTD. You may also notice that the document type specifies the revision that is being used. The current standards are 4.01 for HTML and 1.0 for XHTML although there is sure to be new ones either out now or will be out soon.


Lets take a look at what document types look like for HTML:


Strict rev4.01:

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


Transitional rev4.01:

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


Frameset rev4.01:

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




Lets take a look at what document types look like for XHTML:


Strict rev1.0:

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


Transitional rev1.0:

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


Frameset rev1.0:

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


What to use and When

Strict:

Strict is what you should generally try to use. This is to be used when you are using CSS and the style attribute to format your elements and text.

Transitional:

Transitional should be generally used when you are going to use depriciated elements or depriciated attributes which will not be covered by the tutorial section but will have a list in the reference section. Sometimes this is used for browsers that do not support CSS / Styles. Some CSS / Styles are not supported by some of the most recent browsers and it may be necessary to use this DTD and depriciated code and/or attributes to obtain the desired result.

Frameset:

Frameset should only be used when the browser window is broken up into frames which sometimes is needed. This DTD is comparable to The Tansitional DTD.


The JMBG Network - 45 Madison Ave N Suite 1, Kitchener, ON CA N2H2Z5
Copyright JMBG 2006-2008