Saturday , February 23 2019

DOCTYPE HTML Tag Declaration, Examples

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

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

Read: What is HTML (Hypertext Markup Language)?

Read: Complete HTML Tags List

Example of DOCTYPE html Tag

<!DOCTYPE html>

<html>

<head>

<title>Title of the document</title>

</head>

<body>

<p> Body content of the document </p>

</body>

</html>

Different <!DOCTYPE html> Declaration:

HTML5

The HTML5 is using is very simple document type.

<!DOCTYPE html>

HTML 4.01 Strict

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>

HTML 4.01 Transitional

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>

HTML 4.01 Frameset

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//EN” “http://www.w3.org/TR/html4/frameset.dtd”>

XHTML 1.0 Strict

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

XHTML 1.0 Transitional

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

XHTML 1.0 Frameset

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”>

XHTML 1.1

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>

Browser Support <!DOCTYPE HTML>:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.