Defining document compatibility
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:
<!doctype html> <html> <head> <title>A standards mode webpage</title> </head> <body> <!-- This webpage displays in standards mode --> </body> </html>
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.
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.
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
- Specifying legacy document modes
- When to use legacy document modes
- Configuring web servers to specify document modes
- Controlling default rendering
- Understanding the need for document compatibility modes
CSS Enhancements in Internet Explorer 6