On March 20, 2009, Microsoft released the official version of Windows Internet Explorer 8 (IE8) to the world, which became the focus of people's attention. IE8 is the most standards-compliant version to date. It fully supports Cascading Style Sheets (CSS) level 2.1, has enhanced support for CSS 3, HTML 4.01, and can also support HTML 5 well. Thanks to improved support for these HTML elements, Web developers can now build more expressive and accessible HTML markup. This article will explore the changes to the HTML and CSS support behavior in IE8 and how these changes affect web developers.
HTML improvements
To help developers take full advantage of the elements provided by HTML 4.01 and better interpret the semantic meaning that Web developers expect to express, Windows Internet Explorer has been upgraded with support for the following presentational elements:
P automatically adds element closing tag
A P element that lacks a closing tag automatically adds a closing tag immediately when followed by a TABLE, FORM, NOFRAMES, or NOSCRIPT element.
<html>
<head>
<title>Simple P element end example</title>
<meta http-equiv="X-UA-Compatible" content="IE8"/>
</head>
<body>
<p>This is the first paragraph</p>
<p style="margin-left:30px">This is the second paragraph. <!-- P not closed -->
<table border="1px" cellpadding="2px"><tr><td>This is a table cell. </td></tr></table>
<p>This is the third paragraph. </p>
</body>
</html>
In this example, the second P element is missing the closing tag. When viewed using Windows Internet Explorer 7, the TABLE element appears as a child of the second P element. The second P element is indented 30 pixels from the left margin of the window. Since TABLE is a child of the P element, it is also indented from the left margin of the window. However, when viewed in the default mode of Windows Internet Explorer 8, the TABLE element is aligned with the left margin. Since Windows Internet Explorer 8 automatically adds the missing closing tag of the P element before displaying the TABLE element, the TABLE element is not a child element of the second P element in IE8.
Display images using OBJECT elements
Windows Internet Explorer 8 can display images using the OBJECT element. When using this element to display images in older browsers, it often automatically adds scroll bars and borders to the image, often causing the image to display incorrectly.
In Windows Internet Explorer 8, the OBJECT element displays images as if they were embedded using the IMG element. To use this behavior in a web page, set the DATA attribute of the OBJECT element to the URL of the image. You can also embed dataURL in the DATA attribute.
To have Windows Internet Explorer load images into OBJECT elements that use the old behavior, select old compatibility mode for the web page or set the TYPE attribute of the OBJECT element to text/html.