The HTML layout engines in modern web browsers perform DOCTYPE "sniffing" or "switching", wherein the DOCTYPE in a document served as text/html determines a layout mode, such as "quirks mode" or "standards mode". The text/html serialization of HTML5, which is not SGML-based, uses the DOCTYPE only for mode selection. Since web browsers are implemented with special-purpose HTML parsers, rather than general-purpose DTD-based parsers, they don't use DTDs and will never access them even if a URL is provided. The DOCTYPE is retained in HTML5 as a "mostly useless, but required" header only to trigger "standards mode" in common browsers.
Source: Wikipedia - Document Type Declaration
Example of <!DOCTYPE> in HTML5
<!DOCTYPE html>
<html>
<head>
<title>Title...</title>
</head>
<body>
Body...
</body>
</html>
No comments:
Post a Comment