Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

What is the difference between "quirks" mode and "standards compliance" mode, when building HTML web pages?

How to tell when operating in one mode, vs. the other? Why should people – i.e. webmasters and web designers and developers – care about choosing standards compliance mode over quirks mode?

Is quirks mode ever justifiable when developing new content?

share|improve this question
add comment

7 Answers

up vote 9 down vote accepted

Here is probably the best article about quirks mode that I have found. I personally try to always use standard mode whenever possible since it has the best chances to work with the majority of browsers.

share|improve this answer
add comment

It's choice between:

  • IE5 engine (or bug-for-bug emulation of thereof)
  • Something more modern (best effort in non-IE, long story in IE8…)

If you like to write CSS like it's 1999, without centering working properly, then use quirks.

share|improve this answer
add comment

Quirks Mode makes IE 6 and 7 render CSS differently than the standards say they should.

Standards mode makes IE 6 & 7 render CSS closer to the standards than Quirks Mode does, and thus closer to how Firefox, Safari, Chrome, Opera, and IE 8/9 render it.

Using standards mode means you have fewer weird old IE issues to hold in your head when you’re trying to make a freaking page work. It means you can use books like CSS: The Definitive Guide by Eric Meyer to look up what your page should be doing. IE’s Quirks Mode doesn’t have the same sort of comprehensive documentation.

share|improve this answer
add comment

I have found that if you are using CSS resets or frameworks, if you don't include the doctype to switch the affected browsers (usually IE7 and IE8) in to Standards Mode, a lot of positional stuff starts going wrong. It is nearly always best to set the doctype declaration and use Standards Mode.

share|improve this answer
add comment

As @txwikinger said, quirksmode is the site to see here.

The only additional information that should be of help is this article on how to detect which mode your browser is using on a certain page: Detecting Compat Mode. There are also browser extensions that can do this, like Web Developer Toolbar. There is a version for FF and Chrome.

share|improve this answer
add comment

If you develop in quirks mode, then you are effectively asking the browser to emulate pre-IE6 bugs. Is that really something you want to be doing?

Wikipedia explains the basics of triggering quirks mode, but there are a number of special cases it doesn't cover. The link provided by txwikinger gives a good explanation of the history and the main differences.

Jukka Korpela explains the differences in more detail and also how to check the compatibility mode:

Checking the mode To check which mode (Quirks vs. Standards) a browser is in,

On Firefox, use the command View/Page Info (and see the General pane); or if you have Web Developer Extension, just check an icon in its toolbar (third icon from the right).

For IE, type javascript:alert(document.compatMode) in the address bar, and check whether the popup window then says CSS1Compat (indicating Standards Mode) or BackCompat (indicating Quirks Mode); alternatively, download and install the simple Quirks or Standards Mode Bookmarklet.

It is worth noting that many browsers have two modes other than quirks mode - almost standards mode and standards mode. Unfortunately, IE6 and IE7 only run in almost standards mode and so if you need to support these browsers, it is tempting to try to use almost standards mode in all browsers. However, it is probably better to develop against the standards and then try to fix up browser quirks. HTML5 will only offer the strict mode, so you really should try to develop against this for future compatibility.

share|improve this answer
add comment

Quirks mode is where a browser does not render pages as expected per the HTML spec. At one point, web browsers gained what is essentially a switch - the inclusion of a doctype at the top of a page. Absent that doctype, the browser goes into quirks mode. The presence of a valid doctype forces the browser into standard mode, the "correct" mode.

It is preferable to use standards mode - so, use a doctype! - for moving forward, as this ensures your pages will work correctly and consistently across as many browsers as possible.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.