Date Published:
Last updated:


A Document Type Definition (a.k.a DOCTYPE or the even shorter abbreviation DTD) is used to tell the browser what specification the document adheres too and whether to render in a standards-compliant ("strict") or backwards-compatible, buggy mode ("quirks"). It must appear as the first tag in the document, even before the HTML tag.

Note: !DOCTYPE must appear in captials, which may be counter-intuitive to those used to working in XHTML. Remember, it appears before the HTML document starts...

There are many DTDs out there; listed below are the ones most used for web pages.


<!DOCTYPE html>


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

XHTML 1.0 Strict, Transitional, Frameset

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

HTML 4.01 Strict, Transitional, Frameset

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

Further reading and sources