Investigating Document Mode Issues

In the Enabling Standards Support topic, you learned that the document type of a webpage controls the features supported by the webpage. In order for Windows Internet Explorer and other modern browsers to enable all supported features, webpages must be in standards mode. Put your webpages into standards mode by declaring a standards-based document type, as shown in the following code example.

If your webpages do not declare a standards-based document type, features that require standards-support will not be displayed when viewed with Internet Explorer. If a webpage is not displayed correctly, you can use the F12 developer tools to troubleshoot the issue. In many cases, such problems are resolved by ensuring the webpage uses a !DOCTYPE directive to declare a standards-based document type.

This topic helps you learn how to use the F12 tools to research and identify a problem related to the document type of a webpage.

The design of this webpage includes the border-radius attribute, a Cascading Style Sheets, Level 3 (CSS3) attribute that displays rounded corners. In the current example, however, the corners of the objects are displayed with traditional, squared corners. This happens because Internet Explorer ignores Cascading Style Sheets (CSS) properties that are not supported by the document mode that is used to display a webpage.

Because IE5 (Quirks) mode does not support the border-radius property, Internet Explorer ignores the property when webpages are displayed in that document mode.

By using the F12 tools, you can explore a webpage after Internet Explorer has displayed it. This enables you to troubleshoot and identify problems like the squared corners that are shown in the previous image. This topic shows one way to identify similar problems and includes the following information.

This happens because the webpage is displayed in IE5 mode. In Windows Internet Explorer 9, the border-radius property is supported only in IE9 Standards mode. Because IE5 mode does not support the border-radius property, Internet Explorer ignores the property when displaying CSS attributes.

The next section shows how to verify this by changing the current document mode of the webpage.

Displaying Webpages in Different Document Modes

To use the F12 tools to display webpages in different document modes, complete the following steps.

If the F12 tools are not already open, press F12 to open the tools. Notice that the current document mode is displayed in the right side of the menu bar of the F12 tools window.

When you click the document mode menu button, a menu displays additional document modes that can be used to display your webpage.

Click the Internet Explorer 9 standards option from the menu to display your webpage in IE9 mode. If you trace the style attributes for the previously selected object, the border-radius child attributes now appear with the other CSS attributes.

When the webpage is displayed in the appropriate document mode, the webpage appears as intended and the div elements are displayed with rounded corners.

Remember that the F12 tools change only the way a webpage is currently displayed by Internet Explorer; they do not modify the original source code of the webpage.

If this was a problem with a production webpage, modify the underlying markup to include a !DOCTYPE directive that specifies a standards-based document type, as shown in the following code example.

The F12 tools provide a number of tools that help you to quickly troubleshoot and identify problems with your webpages. In this example, you used them to determine a problem related to the document mode of a webpage. For more information about the F12 tools, see Debugging and Troubleshooting Your Webpage.