DOCTYPE HTML Tag Declaration, Syntax and Example

Basically, the DOCTYPE HTML tag is not an HTML element; it is an instruction to inform the browser, what type of 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 Document Type Declaration for all 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, it remains only for legacy reasons pertaining to processing modes in browsers.

Read: Complete HTML Tags List

Example of <!DOCTYPE html> Tag

<!DOCTYPE html>
<title>Title of the document</title>
<p> Body content of the document </p>

Different <!DOCTYPE HTML> Declaration:


The HTML5 is using is very simple document type.

<!DOCTYPE html>

HTML 4.01 Strict


HTML 4.01 Transitional

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

HTML 4.01 Frameset

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "">

XHTML 1.0 Strict

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

XHTML 1.0 Transitional

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

XHTML 1.0 Frameset

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "">


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">

Browser Support <!DOCTYPE HTML>:

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


Similar Posts