HTML doctype

  • HTML <!doctype> refer to the document type declaration use to specifying which version of HTML the document is using.

  • HTML <!doctype> declaration is not an HTML tag. It's a information about which version of the markup language the page is written.

  • Following doctypes are recommended in W3C specification.

HTML 5

<!DOCTYPE html>

This declaration needs to be the first in your HTML document.

<!DOCTYPE html>
<head>
  ...
  ...
</head>
<body>
  ...
  ...
</body>
</html>

Following are other DOCTYPES that are used on older version.

HTML 4.01 Strict

All HTML tag and attributes are allow to supported document type.It's not allow to frame set and presentational.

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

HTML 4.01 Frameset

HTML 4.01 Transitional allows to use frameset.

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

HTML 4.01 Transitional

HTML 4.01 Transitional allow to use presentational.

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

Browser Compatibility

  • Google Chrome
    Yes
  • Mozilla Firefox
    Yes
  • Microsoft Edge
    Yes
  • Opera
    Yes
  • Safari
    Yes