WHY WE NEED EXAMATION MARK IN DOCTYPE??
In doctype, exclamation mark(!) is at the beginning of the doctype {!Doctype html} is required because it identify the line as a mark up declaration than a standard html element..
Syntax Requirement (SGML/XML): The HTML standard is based on SGML (Standard Generalized Markup Language). In this syntax, markup declarations-which provide instructions to the browser about how to interpret the file-start with a <!.
Preventing "Quirks Mode": The primary, modern purpose of <!DOCTYPE html> is to trigger "standards mode" in web browsers. Without this specific declaration (including the !), browsers may enter "quirks mode," rendering the page in a way compatible with 1990s websites, which causes CSS and layout errors.
Distinction from HTML Tags: It tells the parser that this is a document type definition, not an HTML tag like <br> or <p>.
While HTML5 has moved away from the complex document type definitions used in older versions, it keeps the <! for backward compatibility to ensure the browser strictly follows modern web standards.