Export (0) Print
Expand All

Event 1040 - Cascading Style Sheet (CSS Fixes)

Logged Message

Windows Internet Explorer 8 and Windows Internet Explorer 7 contain a number of improvements to Cascading Style Sheets (CSS) parsing and rendering over Microsoft Internet Explorer 6. The goal of the improvements was to increase the consistency of how Windows Internet Explorer interprets CSS as recommended by the World Wide Web Consortium (W3C), so that developers can have a reliable set of functionality. Some webpages may render differently with Internet Explorer 8 and Internet Explorer 7 than with Internet Explorer 6. You may see this when elements are moved to a different area of the page or in overlapping content when viewed in Internet Explorer 8 and Internet Explorer 7. These issues are common to content using particular CSS constructs (often known as filters) to work around bugs that existed under the strict mode in Internet Explorer 6.

What Is It?

CSS provides the ability for developers to separate the layout and styles of a webpage from the content. Internet Explorer 7 went a long way to improve the CSS rendering of webpages. Internet Explorer 8 continues this trend as is now the most CSS-compliant release yet. If a webpage is rendering differently in Internet Explorer 8 than in previous versions, it's important to understand how CSS works so that you can properly diagnose the problem.

Some of the common causes of rendering issues are:

  • User Agent Strings and Browser Detection
  • XML Prolog and the Strict Switch Method
  • Box Model Changes
  • CSS Filters
CSS is a broad topic. Aside from how it is logged, it's beyond the scope of this document to explain the technology comprehensively. For more detail on CSS please visit the following resources:

When Is This Event Logged?

This event is logged when one of the four categories of CSS issues mentioned above are encountered.

Example

Perform the following steps to see this event logged in the Internet Explorer Compatibility Test Tool:

  1. Create a webpage with the following contents. For this example call it 1040.html.
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title>CSS Test</title>
            <style type="text/css">
            .myclass {
                min-height: 300px;
               _height: 300px;   
            }
            </style>
        </head>
        <body>
            <div>      
                <p class="myclass">Test text</p>        
            </div>
        </body>
    </html>
    
    
  2. Install the 1040.html file in the root directory of the local web server. On a Microsoft Internet Information Services (IIS) server this means putting the files in this directory:

    .\wwwroot

  3. Browse to the file:

    http://localhost/1040.html

The event is fired due to the _height property in the .myclass style. The underscore filter was used to show properties exclusive to Internet Explorer. Internet Explorer 7 and later versions treat these constructs as a custom property, which means that it is still in the object model and can be queried through a script, but it does not natively apply its value

Remediation

For help on working around these issues please refer to the section "My website is Broken; What Can I Do?" in the following document: Cascading Style Sheet (CSS) Fixes.

Related topics

Internet Explorer Application Compatibility
Events 1040 through 1049

 

 

Show:
© 2014 Microsoft