IE7 and IE8 hack behavior

We’ve had the luxury of hacks to fine tune Internet Explorer bugs. Internet Explorer 7 disabled the majority of hacks, with the exception of the * hack. This hack allowed you to send a style only to Internet Explorer by prefacing an attribute with an asterisk.

/*this is for all browsers*/
#main p {color:black;}
/* this is for Internet Explorer */
#main *p {color:red;}
/*this is ignored by IE7 and will target IE6 */
#main _p {color:green;}

This set of hacks allowed us to control IE7 and IE6. However, IE8 does not recognize the * hack. Special IE8 rules will either need to be defined with conditional comments, the Microsoft proposed meta tag, or some new hack to be discovered. Let’s hope the mature version of IE8 will reduce the need for these hacks.

For more information on the above hacks, visit an earlier post: IE7 Hacks



, , , ,




4 responses to “IE7 and IE8 hack behavior”

  1. […] want to update all of your web applications. The quick and dirty solution for you is the * hack. IE8 no longer supports the * hack, so you can edit your patches-ie.css file to make it look like this: *margin-top: 30px; /* for […]

  2. Boris Masis Avatar

    Thanks for pointing out the lack of support for the * hack. I expanded on it at

    Rock on,
    – Boris

  3. Dok de Leon Avatar

    found this while searching for someone who might have had the same experience I had about a “comma” hack/filter for IE8… This seems the closest.

  4. karl Avatar


    #main *p {color:red;}

    is done by Safari, too.

Leave a Reply

Your email address will not be published. Required fields are marked *