What is Doctype and Why doctype required for HTML programming?

Here I am describing about What is Doctype and Why doctype required for HTML programming? The <!DOCTYPE> declaration must be the very first thing in your HTML document, before the <html> tag. The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in. In HTML 4.01, the <!DOCTYPE> declaration refers to a DTD, because HTML 4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly.HTML5 is not based on SGML, and therefore does not require a reference to a DTD.

 
The syntax for the doc type in HTML5 is
<!DOCTYPE html>
The syntax for the doc type in HTML4 is
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
So from these instruction the web browser will understand about the version of HTML .

Example 


<!DOCTYPE html>
<html>
<head>
<title>Dotnetstock.com</title>
</head>

<body>
Dotnetstock.com……
</body>

</html>

Leave a Reply

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