<!DOCTYPE ...>

HTML4 HTML5

The <!DOCTYPE> declaration (we do not call it a tag) appears at the very beginning of the HTML page code, before the <html> tag. The declaration informs the browser about the version of HTML in which the page was written.

Example

A typical HTML document is divided into two sections. The !DOCTYPE declaration is located at the very beginning:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>

<body>
Page content ....
</body>

</html>

In HTML5, the declaration has a very simple form, shown in the example above: <!DOCTYPE html>

In HTML4, we had three fairly complex variations of this declaration:

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">