HTML Document Type <!DOCTYPE html> Declaration
The document type declaration for HTML5 is nice and short. Just <!DOCTYPE html>
. Back in the days of HTML 4 when there was a DTD declaration involved the doctype was a lot longer. Now it's a lot more simple and easy to remember.
<!DOCTYPE html>
likes to hang out at the very beginning of the document before any HTML tags. There is no closing doctype tag at the end of the document. Just that one at the beginning.
Declaring a doctype helps make sure browsers all render the document mostly the same, according to standards. Not setting one of these, or setting the wrong one, or setting one with a typo, might cause weird page rendering issues.
The older doctype declaration for HTML 4 was long. An example of the HTML 4.01 Strict declaration looked like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
See also Complete List of HTML Tags