Conditionally IE7 and @opera rules

As Olli mentioned, Chris Wilson has expounded on important interoperability bug fixes in the future IE7. This list of bug fixes will remove a lot of cross-browser headaches, but ironically fixing them will also add some new ones.

CSS can to a large degree adapt to browsers with a wide range of capabilities by virtue of its compatibility rules. Even proprietary extensions like IE’s filters cause no problem with other browsers, they just ignore them. Unfortunately implementation bugs can ruin this cross-browser harmony. Netscape 4 had some notorious bugs, including crashes, that set back the uptake of CSS for years. It can also be hard do design around the lack of some crucial features like CSS selectors.

With an IE7 with substantially less CSS 2.1 bugs than IE6 but substantially more than Opera/Firefox/Safari (none of which are completely bug-free, though I would claim we are quite good), there is one more browser combination to work around.

The saving grace is IE’s excellent conditional comments. They prevent much uglier CSS hacks that would otherwise be used. CSS hacks practically always have unintended side-effects. They also stick around long after their sell-by date, and they are plain ugly.

I sometimes wonder if we should have similar conditionals. It is fairly hard to make rules that target Opera 8 exclusively. Some have used capabilities like us being the only browser supporting Media Queries right now, but this will have negative consequences. We could add some sniffability ourselves, like e.g. @opera 8 {/* Only processed by Opera 8, ignored by all other compliant browsers */} or even conditional comment support of our own.

Then I remember how much I detest browser sniffing, which over time seems destined to cause more harm than good, and come to the conclusion that encouraging this will likely not be in our own best interest or of the Web at large.

Join the Conversation

  1. I’d have thought conditional comments highlight browser bugs far more explicitly than things like CSS hacks.

  2. Michael C. writes:As a web developer, I’d have to vote to add in something like conditonal comments, although to be honest, Opera’s HTML parsing is definitely good enough that it *generally* doesn’t need it. It was an absolute *MUST* with IE.

  3. Joel “Jaykul” Bennett writes:This attitude basically boils down to protectionism. It’s an incontrovertible fact that each browser renders html and css differently. No amount of ranting about html standards is going to change the fact that a standards compliant web page will look different in Opera and Firefox and IE.Surely there’s only one reason to not make it easier for developers to work around these differences: you’re afraid they would focus on the browsers with the giant market share and there would be even more web pages that break or look horrid in Opera than there are already.

  4. Anonymous writes:Does Opera not have conditional comments? My site looks really good in IE, Safari, and Firefox but Opera is screwing it up, I know how to fix but need conditional comment aimed just at Opera.

Comment

Leave a Reply to Anonymous Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.