As mentioned previously here and elsewhere, Microsoft is working on Internet Explorer 7, which will have greatly improved CSS support. The IE7 team has posted an article about the demise of CSS hacks and broken pages, warning that the hacks often used to target CSS specifically to work around old IE bugs may be unnecessary under IE7 when in strict mode. So, IE will finally have improved support for standards, but all of our old hacks could cause breakage in the new browser. As Monk would say, “it’s a blessing and a curse.”
The recommended workaround is to use IE’s conditional comments feature to load a stylesheet with rules specifically for IE6 and older. For example you might put something like this in the
<head> of your document:
<link rel="stylesheet" type="text/css" href="compliant.css" /> <!--[if IE lt 7]> <link rel="stylesheet" type="text/css" href="ie-rules.css" /> <![endif]-->
This would load the compliant.css file for all browsers. Then, the conditional comment would load the ie-rules.css file only for Internet Explorer with a version less than 7. All other browsers (including IE7) would ignore this comment. [Note, however, that this hack doesn’t apply to the specific Slashdot example used in the IEBlog article. Read the comments to see why.]
Note that this only applies if you are using IE-specific hacks in standards-compliance mode. This includes hacks which target rules to only work in IE (like my favorite, the star html hack), or rules that only work in compliant browsers (like the child selector hack). And it may not be necessary in all cases anyhow, depending on how you are using those rules (the main problem is probably going to be that the star html hack won’t work in IE7 even in quirks mode). Theoretically, if you are using quirks mode, then you can probably just continue using your old hacks. However, I think most of us would probably prefer to keep to the standards whenever possible.