What is a DocType?
A DOCTYPE statement (or DTD), located on the first line of an HTML document, designates the standard of HTML which you have chosen to use. HTML Validators require DTD statements. Without a DTD, they will usually fall back to a default DTD (many times HT ML 2.0), most times causing many errors. Two common DTDs are: For HTML 4.0 transitional: !DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN” For HTML 3.2 !DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2 Final//EN” There are many more DTD statements available for use. A more comprehensive listing can be found at http://ugweb.cs.ualberta.
A doctype tells the browser which version of HTML to expect. It also tells it how to parse the page. A page with no doctype goes into quirks mode, and may give some undesired results. A list of all the doctypes can be found at http://www.w3.org/QA/2002/04/valid-dtd-list.html but here are some of the more common ones: HTML 4.01 Strict, Transitional, and Frameset: Transitional – This doctype is good for beginners learning to code. It is more forgiving than the strict doctype. Use this if you are just learning how to validate your code.