HTML <!DOCTYPE> Tag
The <!DOCTYPE html> declaration, also known as the document type declaration (DTD) is present in an HTML document before the <html> tag to give the information about the HTML version used in that document. It is neither a tag nor an element but is an instruction to the browser. Being a null element, it neither contains a closing tag and nor any content within it. Adding a declaration to an HTML document is a good practice. It is not case sensitive.
The HTML 4.01 Strict, HTML 4.01 Transitional, HTML 4.01 Frameset, XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1 etc. are the various types of HTML. The different HTML versions differs in the <!DOCTYPE> declaration. In HTML 4.01, which is based on SGML, the <!DOCTYPE> declaration refers to the Document Type Declaration (DTD). The rules for markup languages is defined by DTD so that the browsers recognize the content correctly. The HTML 5 is however not based on SGML.
Syntax: For HTML 5.
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <p>Hello World!!</p> </body> </html>
In the above example, we displayed the use of the HTML <!Doctype> Tag.
Chrome, IE, Firefox, Opera and Safari.