Web Debug

Fix broken web applications, from servers to clients.

How Internet Explorer Chooses Between Document Modes

By default, Windows Internet Explorer 8 uses IE8 mode, Windows Internet Explorer 9 uses IE9 mode, etc. However, Windows Internet Explorer uses several criteria to determine which document mode to use. For example, if an HTML page contains a valid  declaration (see [HTML]), Internet Explorer uses one of the standards-based document modes. But, if there is no valid  declaration, Internet Explorer uses quirks mode.

The following rules determine how Internet Explorer selects the document mode:

  1. The Developer Tools setting overrides any document mode specified by a webpage. The setting remains active for the lifetime of the tab.
  2. In Internet Explorer 9, if the document is hosted in an iframe element, the document mode is determined by the document mode of the top-level webpage. Subdocuments cannot be rendered in IE9 mode unless the top-level document is also in IE9 mode.
  3. meta tag with a value of X-UA-Compatible or a HTTP response header can override items in the Compatibility View Settings list and the doctype unless the X-UA-Compatible value is a Compatibility View setting, such as IE=EmulateIE7 or IE=EmulateIE8.
  4. The Compatibility View settings can force a webpage to be displayed in a less-standard document mode.
  5. If none of these rules apply, the <!DOCTYPE> declaration determines whether the webpage renders in a standards mode, Almost Standards mode, or quirks mode.







<!DOCTYPE> declaration Document Mode Impact
HTML 4.0 and higher<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3org/TR/html4/strict.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3org/TR/html4/strict.dtd">

XHTML with or without a system identifier

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3org/TR/xhtml11/DTD/xhtml11.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3org/TR/xhtml-basic/xhtml-basic10.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Unknown

<!DOCTYPE html>

Standards mode
XHTML Transitional or Frameset<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhmlt1-transitional.dtd">

HTML 4.0 or HTML 4.01 Transitional or Frameset with a system identifier

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3org/TR/html4/loose.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3org/TR/html4/loose.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3org/TR/1999/REC-html401-19991224/loose.dtd">

"Almost Standards" mode (standards mode in IE7)
HTML 4 and lower, or no DOCTYPE<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

None

Quirks mode

Reference

http://msdn.microsoft.com/en-us/library/ff406036(v=vs.85).aspx

Fork me on GitHub