↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

What the hell is <!DOCTYPE html>?

The page says that older HTML documents used a doctype declaration with a reference to a DTD, which described the document structure and the valid elements it could contain. It then explains that HTML5 no longer needs that SGML-based reference, but the doctype still matters because it tells browsers to run the page in standard mode.

Reading notes
#

  • A DTD describes the structure of an XML document and the legal elements it can contain.
  • Before HTML5, HTML documents used a doctype declaration with a DTD reference on the first line.
  • That declaration provided the list of valid elements and identified whether the DTD was strict, transitional, or frameset.
  • HTML5 no longer needs a DTD reference because it is not SGML based.
  • In HTML5, <!DOCTYPE html> tells the browser to use standard mode.
  • Without a valid doctype on the first line, the browser may switch to quirks mode.
  • The page links quirks mode to older browsers and to legacy code that broke when standards-based behavior became common.