Browser standard mode with weird mode-css1compat and Backcompat

Source: Internet
Author: User

  

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.