What is doctype in html

A doctype is refers to a Document Type Definition (DTD) and declaration of the HTML.It is an instruction to the web browser about what version of HTML the page is written in.The DTD specifies the rules for the markup language, so that the browsers render the content correctly based on HTML version.

HTML2:
  1. <!DOCTYPE HTML PUBLIC ”-//IETF//DTD HTML 2.0 Level 2//EN”>  

HTML3:
  1. <!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 3.0//EN”>  

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

HTML5:
  1. <!DOCTYPE html>