Home » HTML » HTML Doctypes

HTML Doctypes

A DOCTYPE is Document Type Declaration. It specifies the version of markup language used in the webpage. A DOCTYPE declaration appears at the top of a web page before all other elements.


HTML5 Doctype

The HTML5 declaration is the most simple one till now as compared to previous html versions. The webpage will work even if the doctype is not declared but it is good practice to use the proper syntax.

The DOCTYPE for HTML5 is case-insensitive.

Syntax
<!DOCTYPE html>

The previous versions HTML doctypes were longer because the those versions were SGML-based(Standard Generalized Markup Language) and therefore required a reference to a DTD(Document Type Definition). With HTML5 this is no longer the case and there is no need to declare the version.


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> HTML DOCTYPE Declaration </title>
</head>
<body>
. . .
</body>
</html>

Browser Support

Element
Microsoft Edge browser.png Edge
Chrome browser.png Chrome
Firefox browser.png Firefox
Opera browser.png Opera
safari browser.png Safari
<doctype>
Yes
Yes
Yes
Yes
Yes








Follow Us: