Why do we use DOCTYPES in HTML document?

HTMLWeb DevelopmentFront End Technology

The HTML <doctype> tag is used for specifying which version of HTML the document is using. This is referred to as the document type declaration (DTD).

The <!DOCTYPE> declaration is the first thing you can see in the HTML document. It gets added before the <html> tag. The <!DOCTYPE> tag does not have an end tag!.


HTML 4.01 had 3 possible doctypes − HTML 4 Strict, HTML 4 Transitional, and HTML 4 Frameset. Every HTML document you create should have one of these three DTDs.

HTML 4 Strict

This document type includes all HTML elements except those that have been deprecated and those that appear in frameset documents.


HTML 4 Transitional

This document type includes all HTML elements including those that have been deprecated.

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

HTML 4 Frameset

This document type includes all HTML elements in the transitional DTD as well as those in a framed document.

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

HTML 5 Declaration

In HTML5 there is only one declaration i.e.

<!DOCTYPE html>

Published on 07-Feb-2018 09:42:46