DTD: Document Type Definition Document type definition
SGML is a very powerful but complex markup language, from which HTML and XML are derived.Why is there a "!"?The statement is not an HTML tag; 's location ? The statement must be located on the first line of the HTML document, before the tagWhat is the role of? Tell the browser what standard to use to parse this document. A non-existent or incorrectly formatted DOCTYPE will cause the document to be rendered in compatibility mode. What is the difference between HTML4.01 and HTML5 DOCTYPE? HTML5 has only one declaration:
HTML4.01 has three declarations: strict, transitional, frameset
HTML5 is not based on SGML and does not need to reference DTD, but it needs to use DOCTYPE to standardize browser behavior.
SGML is the most powerful and ancient. XML is a subset of SGML. HTML originally tried to be a subset of SGML, but HTML 4 did not strictly conform to the standards of SGML before. Later came HTML4, XHTML (HTML that conforms to the XML standard), both of which comply with the requirements of SGML. When the W3C formulated the HTML5 standard, it hoped to get rid of some useless functions and declarations of SGML and continue the style of HTML4 rather than the strict style of XHTML.Rendering mode of the pageThe rendering mode of the page triggers compatibility mode and standard mode respectively depending on whether DOCTYPE is declared.
document.compatMode can return the compatibility mode of the current page:
document.compatMode > CSS1Compat //标准模式 > BackCompat //怪异模式、兼容模式
In compatibility mode, pages are displayed in a loosely backwards compatible manner, simulating the behavior of older browsers to prevent the site from not working.