The DOCTYPE Statement
A DOCTYPE statement in an HTML document declares the document type and level of HTML syntax. The DOCTYPE statement is very important, as it is used by software that reads the document. This software includes Web browsers and HTML validators.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
You should also add this character encoding statement in the HEAD element of your document:
<meta http-equiv = "Content-Type" content = "text/html; charset=iso-8859-1">
The DOCTYPE statement and the character encoding statement will help you. You'll need these to have your documents pass syntax validation.
You might see a DOCTYPE statement in a Web document at the HTML 2.0 level:
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">Notice the slight difference in this HTML 2.0 document type. Instead of "W3C" (meaning World Wide Web Consortium), it has the string "IETF" (meaning Internet Engineering Task Force), which was the organization that created this early HTML standard.
If you use HTML features above the 3.2 level, you'll need to have a different DOCTYPE statement. For example, if you want to use color in TD (table data) or TH (table header), or if you want to use style sheets, you could use this DOCTYPE statement instead. Place it at the top of your HTML file, before the HTML element's opening tag:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">You could also use the following DOCTYPE statement if you want to use some stricter HTML features at the HTML 4.01 level:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
Note that there is no HTML above the 4.01 level! (There will never be an HTML 4.2, for example.) HTML is now being developed as XHTML. But it is perfectly OK to create HTML 3.2, HTML 2.0, or HTML 4.01 documents. Sometimes these simpler document types meet the requirements of the job and the constraints and costs of production, maintenance, training, accessibility, and usability far better than "advanced" document types.