The function of HTML DOCTYPE

Time:2020-7-27

The document mode has the following two functions:

1. Tell the browser what HTML or XHTML specification to use to parse HTML documents

2. It has an impact on the browser’s rendering mode; different rendering modes will affect the browser’s parsing of CSS code and even JavaScript script, so DOCTYPE is very important, especially in IE series browsers, the rendering mode of HTML page determined by DOCTYPE is very important.

Two rendering modes:

Backcompact: Standard compatibility mode is not enabled (or quirks mode, hybrid mode)
Css1compat: Standard compatibility mode is on (or standards mode / strict mode)