One of the attributes of an html document that is often overlooked is the Document Type Definition, or the DTD as it more commonly referred to.
This definition precedes any of the document tags it exists to inform client browsers of the format of the following content in the document and what tags to expect the methods it needs to support etc.
Within the structure of an html file the DTD acts as an identifier
The <!DOCTYPE> tag is employed to specify an existing DTD which contains all the elements, definitions, events etc that are associated with the document type.
An html documents <!DOCTYPE> tag should look like the example below.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML4.01//EN"
"http://www.w3.org/TR/html4strict.dtd">
The tag in the example above spcifies the information listed below.
-
The documents top level tag is HTML (html).
-
The document adheres to the Formal Public Identifier (FTP) "W3C HTML 4.01 Strict English" standards (PUBLIC "–//W3C//DTD HTML 4.01//EN").
-
The full DTD can be found at the URL http://www.w3.org/TR/html4/strict.dtd"
The DTD's can be one of 3 types strict, transitional, or frameset, the type of DTD used depends upon the version of html used in the the document.
There have been a few versions of html along the way, ie html 1.0,then html 2.0 and then html 3.2, and 4 .01 right up to today and xhtml 1.0, and xhtml 1.1.
These are all the contemporary Document Type Declarations for html 4.01, that can be used in your documents.
html 4.01 Strict DTD:
This DTD is used when you want the markup (html code) to be clean and uncluttered by formatting, this is achieved via CSS styles either in the head of the document, or on a separate stylesheet.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML4.01//EN"
"http://www.w3.org/TR/html4strict.dtd">
html 4.01 Transitional DTD:
This DTD is used when you need to use formatting in the markup (html code), ie presentational attributes and elements that the W3C expects to be moved either to the head of the document of a separate stylesheet.
This may be because your target audience dont have browsers that suport CSS.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"
html 4.01 Frameset DTD:
This DTD should be used for documents that use frames, the frameset DTD is equal to the Transitional DTD, except the frameset element replaces the body element.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
These are all the contemporary Document Type Declarations for xhtml 1.0 that can be used in your documents.
xhtml 1.0 Strict DTD:
This DTD is used when you want the markup (html code) to be clean and uncluttered by formatting this is achieved via CSS styles either in the head of the document, or on a separate stylesheet.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
xhtml 1.0 Transitional DTD:
This DTD is used when you need to use formatting in the markup (html code), ie presentational attributes and elements that the W3C expects to be moved either to the head of the document or to a separate stylesheet.
This may be because your target audience dont have browsers that suport CSS.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
xhtml 1.0 Frameset DTD:
This DTD should be used for documents that use frames, the frameset DTD is equal to the Transitional DTD, except the frameset element replaces the body element.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1-frameset.dtd">
This is the last DTD and there is only the one at the moment for xhtml 1.1.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
The screen shot below illustrates the <!DOCTYPE> or DTD
used for all the documents on this web site.
Downloads:
|
Download a list of DTD’s in a text file.
|
You can find more information here at the W3schools web site on DTD’s
A full list of all the DTD’s is available here on the W3C web site Doctypes
It is also possible to pass information and commands to the client browser and also provide information about the document for Search engines by including meta tags in the head section of the document.
|