Due to historical reasons, each browser has different rendering on the page, and even the same browser in different versions, the page rendering is not the same. Before the introduction of the world standard, the browser has no uniform specification on the rendering of the page, resulting in a difference (Quirks mode or compatibility mode); Due to the introduction of the world standard, browser rendering page has a unified standard ( Csscompat or Strict mode is also called Standars mode), which is the simplest difference between the two.
After the introduction of the standard, the browser began to adopt the new standards, but there is a problem is how to ensure that the old page can continue to browse, before the standard comes out, many pages are based on the old rendering method, if used by the standard to render, will cause the page to show an exception. In order to maintain the compatibility of browser rendering, so that the previous page can browse normally, the browser retains the old rendering methods (such as: Microsoft's IE). In this way, Quircks mode and standars mode are generated on the browser rendering, and there is a common browser for both rendering methods.
Backcompat corresponds to quirks mode
Css1compat corresponds to strict mode
Backcompat: Standard compatibility mode is off.
Css1compat: Standard compatibility mode is turned on.
in standars mode:
Element true width = margin-left + border-left-width + padding-left + width + padding-right + border-right-width + margin-right;
In quirks mode:
Width is the actual width of the element, content width = width-(margin-left + margin-right + padding-left + padding-right + border-left-width + border-righ T-width);
In JS how to determine how the current browser is parsing?
Window.top.document.compatMode
How to set to Weird mode:
Method One: Add <! in the page item section DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
Method Two: Nothing is added.
How to set to Standard mode:
Add any of the following: HTML4 offers three types of doctype to choose from:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 frameset//en" "HTTP://WWW.W3.ORG/TR/HTML4/FRAMESET.DTD" >
Browser standard mode with weird mode-css1compat and Backcompat