When writing an HTML page the First order of business is to identify what type of HTML you are using in the page. For this we use <!DOCTYPE>
. This directive goes at the very top and it defines the type of document to render.
DocTypes have been narrowed down over the years and there are only a few left...
HTML 4 Strict...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4 Transitional...
<!DOCTYPE html PUBLIC "- Transitional//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
XHTML or XML 1.0 Strict...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML or XML 1.0 Transitional...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
These doc types reference the DTD or the Document Type Definition. The DTD is a virtue of SGML which is what HTML was originally based on.
The DTD defines the language that is used in the document i.e. the tags and their attributes.
HTML 5
<!DOCTYPE HTML>
Why is HTML 5 so simple? Because HTML 5 is not based on SGML... therefore it has no DTD.