Browser quirks and standards mode

Weird Mode and Standard Mode

On the web long ago, there were usually two versions of pages: a version for Netscape’s Navigator, and a version for Microsoft’s Internet Explorer. When the W3C created web standards, in order not to break existing websites at the time, browsers couldn’t just drop these standards. As a result, browsers have adopted two modes to differentiate sites that comply with the new specification from legacy sites.

The current browser’s typesetting engine uses three modes: Quirks mode, Almost standards mode, and Standards mode. In quirks mode , typography emulates the non-standard behavior of Navigator 4 and Internet Explorer 5. This is necessary in order to support sites that were built prior to the widespread adoption of web standards. In standards mode , the behavior is (hopefully) the behavior described by the HTML and CSS specifications. In near-standard mode , only a few weird behaviors are implemented.

How does the browser decide which mode to use?

For HTML files, the browser uses the DOCTYPE at the beginning of the file to decide whether to use quirks mode or standards mode. To make sure your page uses standard mode, make sure your page has a DOCTYPE as in this example:

 <! DOCTYPE

The post Browser Quirks and Standards Mode first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/9706
This site is for inclusion only, and the copyright belongs to the original author.