HTML <!DOCTYPE> Declaration
<title>Title of the document</title>
The content of the document......
<!DOCTYPE> The statement is at the forefront of the document, at <html> Before the label.
<!DOCTYPE> The declaration is not an HTML tag; it is used to tell the Web browser which HTML version is used.
In HTML 4.01，<!DOCTYPE> The declaration needs to refer to DTD (Document Type Declaration) because HTML 4.01 is based on SGML (Standard Generalized Markup Language). The DTD specifies the rules of the markup language to ensure that the browser can render the content correctly.
HTML5 is not based on SGML and does not require a reference to DTD.
Tip: Always add to your HTML documents <!DOCTYPE> Declaration to ensure that the browser knows the document type in advance.
Differences Between HTML 4.01 and HTML5
There are three different <!DOCTYPE> declarations in HTML 4.01. In HTML5 there is only one:
HTML Elements and Doctypes
Look at our table of all HTML elements, and what Doctype each element appears in.
Tips and Notes
Tip: The <!DOCTYPE> declaration is NOT case sensitive.
Tip: You can go here to validate if your document is valid HTML.
Common DOCTYPE Declarations
HTML 4.01 Strict
This DTD contains all HTML elements and attributes, but does NOT INCLUDE presentational or deprecated elements (like font). Framesets are not allowed.
HTML 4.01 Transitional
This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements (like font). Framesets are not allowed.
HTML 4.01 Frameset
This DTD is equal to HTML 4.01 Transitional, but allows the use of frameset content.
XHTML 1.0 Strict
This DTD contains all HTML elements and attributes, but does not include presentational or outdated elements such as font. Framesets are not allowed. The structure must be written in XML in a standard format.
XHTML 1.0 Transitional
This DTD contains all HTML elements and attributes, including presentational or outdated elements (such as font). Framesets are not allowed. The structure must be written in XML in a standard format.
XHTML 1.0 Frameset
This DTD is the same as XHTML 1.0 Transitional, but allows frameset content.
This DTD is the same as XHTML 1.0 Strict, but allows you to add modules (such as Ruby support for East Asian languages).