Before HTML5, an HTML document was also an SGML document. SGML documents use the DOCTYPE declaration to indicate their grammar (through a Document Type Declaration file ). Different versions of HTML were specified by simply using different grammars. Therefor, the DOCTYPE, in the context of HTML, indicates which version of HTML we want the browser to use.
Since HTML5, HTML is a standalone language with a well defined structure. This standardization ensures that browsers understand how HTML works and can consistently interpret its structure without relying on an external file (DTD). So, DOCTYPE, when using HTML5 can be used without any argument because the browser won't need any.
Top comments (0)