<!๐๐๐๐๐๐๐ ๐ก๐ญ๐ฆ๐ฅ>
<html>
<body>
๐๐ก๐ฒ ๐๐จ ๐ฐ๐ ๐ง๐๐๐ ๐ข๐ญ?
</body>
</html>
An HTML ๐งต
<html>
<body>
๐๐ก๐ฒ ๐๐จ ๐ฐ๐ ๐ง๐๐๐ ๐ข๐ญ?
</body>
</html>
An HTML ๐งต
โ History
โฌ Towards the end of the 1990s, pages were written separately for
โค Netscape Navigator
โค Microsoft IE.
โฌ When the web standards were made at W3C, browsers could not just start using them, as doing so would break most existing sites on the web.
โฌ Towards the end of the 1990s, pages were written separately for
โค Netscape Navigator
โค Microsoft IE.
โฌ When the web standards were made at W3C, browsers could not just start using them, as doing so would break most existing sites on the web.
โฌ These browsers, therefore, introduced 2 separate modes to treat new standards-compliant sites differently from old legacy sites.
โฌ Modes were
โค Standards Mode
โค Quirks Mode
โฌ Modes were
โค Standards Mode
โค Quirks Mode
โฌ For HTML documents, browsers use DOCTYPE at the beginning of the document to decide which mode to handle.
โฌ The reference to DOCTYPE is actually borrowed from SGML to HTML.
โฌ The reference to DOCTYPE is actually borrowed from SGML to HTML.
โ Doctype
โฌ In HTML, the doctype is "required" to ensure that the browser makes a best-effort attempt to follow the relevant specifications.
โฌ Doctype is "not" an HTML element, but rather a special instruction to the browser.
โฌ In HTML, the doctype is "required" to ensure that the browser makes a best-effort attempt to follow the relevant specifications.
โฌ Doctype is "not" an HTML element, but rather a special instruction to the browser.
โฌ If specified,
โ it has to be at "the beginning" of the HTML document
โ just after the Byte-Order-Mark (BOM) if any
โฌ The DOCTYPE for HTML5 is "case-insensitive" and can be written as
< !DOCTYPE html >
โ it has to be at "the beginning" of the HTML document
โ just after the Byte-Order-Mark (BOM) if any
โฌ The DOCTYPE for HTML5 is "case-insensitive" and can be written as
< !DOCTYPE html >
โ Formats of Doctypes
There are 3 types
โค Normal
โค Deprecated
โค Legacy Tool Compatible
There are 3 types
โค Normal
โค Deprecated
โค Legacy Tool Compatible
Examples:
โค Normal (HTML5)
<!DOCTYPE html>
โค Deprecated (HTML 4/4.01, XHTML 1.0/1.1)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
โค Legacy Tool Compatible
<!DOCTYPE html system "about:legacy-compat">
โค Normal (HTML5)
<!DOCTYPE html>
โค Deprecated (HTML 4/4.01, XHTML 1.0/1.1)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
โค Legacy Tool Compatible
<!DOCTYPE html system "about:legacy-compat">
โ What if Doctype is not specified?
โฌ Browsers will switch into "Quirks Mode" when rendering a document.
โฌ Quirks Mode "may be" incompatible with some standard specifications.
โฌ Browsers will switch into "Quirks Mode" when rendering a document.
โฌ Quirks Mode "may be" incompatible with some standard specifications.
โฌ Handling of Quirks Mode varies from browser to browser.
โฌ Hence, the document may "render differently" in different browsers.
โฌ Hence, the document may "render differently" in different browsers.
โ What if Doctype is specified?
โฌ Browsers will render the document in "Standards Mode".
โฌ From the doctype, the corresponding HTML version is found, and thus the browser would know about the required standards.
โฌ Browsers will render the document in "Standards Mode".
โฌ From the doctype, the corresponding HTML version is found, and thus the browser would know about the required standards.
๐ Let's summarise
โฌ "<!DOCTYPE html>" is a required preamble found at the top of all HTML documents.
โฌ Its sole purpose is to prevent a browser from switching into โQuirks Modeโ when rendering a document.
โฌ "<!DOCTYPE html>" is a required preamble found at the top of all HTML documents.
โฌ Its sole purpose is to prevent a browser from switching into โQuirks Modeโ when rendering a document.
ุฌุงุฑู ุชุญู ูู ุงูุงูุชุฑุงุญุงุช...