Is this <!doctype html> an HTML element ?
what does <!doctype html> represent in HTML ?
TL;DR, It’s not an HTML Element
So a typicall HTML biolerplate code looks like this
<!doctype html>
<html lang="en" class="dark">
<head>
<meta charset="utf-8" />
</head>
<body>
</body>
</html>
In this code the <!document html>
that appears to be a HTML tag isn’t a HTML tag at all.
In very early days of browsers, internet and web. There were mainly two browsers Netscape Navigator and Microsoft Internet Explorer. Before W3C gave any standardization, web pages were written in two standards according to browsers.
But when web standards came into the picture a new mode was introduced so that all browser engines can follow that.
In order to not to break the previous written websites W3C introduced this new mode using a special declaration as the <!doctype html>
the one declaration unified browser engines to use one standard.
These browser engines rendering modes were known as quirk modes. After the standardization there were 3 modes
- Quirk mode
- Limited Quirk mode
- No Quirk mode
All modern browser these days uses No Quick mode for layouts