Ergonomic tablet input device. An essential component to the proper structure of an HTML document is the <DOCTYPE> statement. Following standard coding practices ensures that your pages will transform gracefully across multiple display devices and browsers. The <DOCTYPE> statement indicates the version of HTML in which the page is written.
A component of the <DOCTYPE> statement is the document type declaration that names the Document Type Definition (DTD). There are different DTDs for each Web language (for example, HTML 3.2, HTML 4.01, XHTML, XML, etc). These are published by the World Wide Web (W3C) consortium, and each one defines to the browser or display device how HTML elements and attributes are to be interpreted.
Below are some examples of <DOCTYPE> statements. Click on each link to see the associated DTD file:
HTML 4.01 Transitional DTD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Strict DTD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Frameset DTD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
XHTML-1.0-Strict DTD
<!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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
XHTML-1.0-Frameset DTD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
The <DOCTYPE> statement is also a necessary component for validating your HTML. Pages that are well structured, follow proper syntax, and pass the W3C validator are the most accessible.
Create documents that validate to published formal grammars. [W3C WCAG 1.0, Checkpoint 3.2, Priority 2]
All documents must begin with one consistent, valid <DOCTYPE> statement as the very first line of code.
It is recommended that new or revised pages be brought into compliance with the XHTML-1.0-Transitional DTD (or even a more recent XHTML format). Existing pages can continue to use the HTML 4.01 Transitional DTD. Pages should properly validate according to the chosen DTD.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">