Document Type Declaration-Definition and Usage

Document Type Declaration or DTD is the first declaration of HTML5 code . It is used to declare that which type of this document is . This declaration is used in almost all markup languages such as all versions of HTML, XHTML etc .

It helps the web browsers to render the web page content correctly.

Syntax is same but document type value is different according to development language . Such as in HTML5 used “html” .


Syntax of Document Type Declaration or DTD is start with “<!” sign ,then DOCTYPE is the element name . At the end “html” in small letter is type of the document . “html” value is used for HTML5 .

It is written as <!DOCTYPE html> . Actually it is not a tag ,but it is the declaration of the document . This is the reason ,it has no closing tag ,like other HTML tags .

It is also called Document Type Declaration or DTD .It is written on top of the page , without leave any space .


<!DOCTYPE html>


  <title> This is title </title>




How <DOCTYPE html> is Processed

Angle bracket “<” tells the web browser to process this keyword . Click on the link to learn in deep ,how a HTML tag works and how it is processed .

It tells the web browser that “this document is an HTML document” . After read this declaration web browser understand that this document is treated as HTML document .

Why It Required

It is the basic requirement to create a web page . Suppose developer don’t use this Document Type Declaration or DTD before create a web page . In that case no direct visual impact seen many times . But later on web browsers do not understand how to process this document without using DTD or DOCTYPE  and give some unwanted behavior in some areas of webpage.