Updated: November 2012
Document compatibility defines how Windows Internet Explorer renders your webpages. Like other popular browsers, Windows Internet Explorer supports document compatibility modes that affect the way webpages are interpreted and displayed. These modes, also called document modes, allow you to choose between support for the latest standard or support for certain behaviors popularized by older browsers. Here you'll learn about the document compatibility modes supported by Internet Explorer and other popular browsers, and how to specify the document mode for a webpage.
The document mode of a webpage is determined by its document type, which is specified using a <!DOCTYPE> directive, as shown here:
<title>A standards mode webpage</title>
<!-- This webpage displays in standards mode -->
All versions of Internet Explorer released after Internet Explorer 6 support up to three document modes:
- Standards mode provides the greatest support for the latest standards, such as HTML5, CSS3, SVG, and others. This is the preferred mode for new public websites.
- Quirks mode emphasizes compatibility over standards compliance by supporting behavior found in earlier versions of Internet Explorer.
- Almost-standards mode supports APIs defined by the latest standards while honoring graphic rendering behavior found in earlier browsers.
In the example shown earlier, the webpage is displayed in standards mode because it contains a <!DOCTYPE> directive that defines the page as an HTML5 document type.
When Internet Explorer encounters a webpage that contains a <!DOCTYPE>, it uses the value of the document type to determine the document mode for the webpage.
If Internet Explorer encounters a webpage that doesn't contain a <!DOCTYPE> element, it opens the page in quirks mode, which can lead to several unexpected side-effects if you're unfamiliar with the directive. For more info, see How to Enable Standards Support.
As of Internet Explorer 10, quirks mode behaves differently than it did in earlier versions of the browser. In Windows Internet Explorer 9 and earlier versions, quirks mode restricted the webpage to the features supported by Microsoft Internet Explorer 5.5. In Internet Explorer 10, quirks mode conforms to the differences specified in the HTML5 specification. For more info, see Specifying legacy document modes
To determine the document type of a webpage, see Investigating Document Mode Issues.
In certain cases, it might be necessary to restrict the display of a webpage to a document mode supported by an earlier version of Internet Explorer. You can do this by serving the page with an
x-ua-compatible header. For more info, see Specifying legacy document modes.
In this section
About conditional comments
CSS Enhancements in Internet Explorer 6
Mark of the Web
Understanding the Compatibility View List