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:

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 Windows 8, quirks mode and almost-standards mode are supported only for Internet Explorer. Windows Store apps using JavaScript only support standards mode. Quirks mode and almost-standards mode are legacy document modes and should only be used in
rare exceptions.

Note 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.

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.