This post is first published on hackinbits.com.
Doctype is required in HTML document for legacy reasons. Its main purpose is to prevent the browser from entering 'Quirks Mode' while rendering the document.
Including the DOCTYPE in a document ensures that the browser makes the best-effort to follow standard specifications. The doctype should be included at the beginning of the HTML document as shown in the example, below.
<!DOCTYPE html>
<html>
<head>
<title>Including Doctype in HTML Document</title>
</head>
<body>
<h1>
Including Doctype in HTML Document
</h1>
<p>
Welcome to hackinbits.com
</p>
</body>
</html>
In HTML5, Doctype's only purpose is to activate the full standard mode.
Top comments (0)