How does the Doctype work in HTML

lortega

Luis Ortega

Posted on August 25, 2023

How does the Doctype work in HTML

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.

💖 💪 🙅 🚩
lortega
Luis Ortega

Posted on August 25, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related