DOCTYPE html Tag Declaration

Basically, DOCTYPE HTML is not an HTML element; it is an instruction to inform the browser, what type of the HTML version is used in the HTML file.

The <!DOCTYPE html> document type declaration is very important and must be inserted before the <HTML> tag.

The HTML !DOCTYPE tag is the very first thing that every web document should have.

The Document Type Declaration (DTD) is unique for each version of HTML and must be written exactly as it is, to be of some use. For this reason, it’s better if you just copy and paste the code for the declaration you’re about to use.

Below is a list of DTDs for all the versions of HTML (XHTML included), and others like SVG and MathML. But remember that, as of today, there’s no need to use any other declaration than the one for HTML5, as this is, by far, the preferred version (unless you’re working on a very particular project).

In HTML5, the !DOCTYPE declaration remains only for legacy reasons pertaining to processing modes in browsers.

Read: Complete HTML Tags List

Example of <!DOCTYPE html> Tag

Different <!DOCTYPE HTML> Declaration:

HTML5

The HTML5 is using is very simple document type.

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

Browser Support <!DOCTYPE HTML>:

  • Inter Explorer (all)
  • Google Chrome (all)
  • Firefox (all)
  • Safari (all)
  • Opera (all)