In a recent article on the IE Blog, Justin Rodgers talks about further CSS improvements in the ever more impatiently awaited IE 7 beta 2. His message is that CSS hacks will start to break in IE 7, and I fully agree.
Nearly two years ago I warned against the excessive use of CSS hacks, because I envisioned a situation like this. Web developers who rely on CSS hacks are going to have serious problems.
Rodgers announced that IE 7's selector support will change in two ways:
* htmlhack any more.
As we all know, these selectors are often used to give different instructions to Explorer Windows than to the other browsers. Using the
> selector ensured that styles are not parsed by Explorer, while using the
* html hack ensured that styles are parsed only by Explorer.
Incidentally, Rodgers seems to think that these two hacks are usually applied together, the one for applying non-IE styles and the other for applying IE-only styles. In my experience, however, web developers generally use only one of the two hacks.
Rodgers furthermore seems to feel that the two changes to IE's rendering engine cancel each other out. I disagree. Even if these hacks have been applied on the same pages and both stop working, what's going to happen next depends entirely on the exact CSS support of IE 7. If the fundamental IE problem which the hack was supposed to solve has been solved itself, fine. But if it hasn't been solved ... oh boy!
Let's be absolutely clear: Microsoft is doing the right thing. The blame for this mess lies squarely with web developers who have relied too much on CSS hacks.
The IE team quite rightly wants to improve the standards support of its browser, so it removes parsing errors and adds new selectors. This has to be done anyway, so why not now?
Now if the IE team would simultaneously solve all other CSS rendering bugs, there would be no problem. The hacks wouldn't work any more, but they wouldn't need to work any more: the bugs they circumvented have been solved.
Unfortunately I am quite sure that the new IE 7 will not solve every single CSS bug that has ever plagued IE 6 and lower. Therefore some special IE styles that are still necessary will not be applied any more, since the CSS hacks that were supposed to add them don't work any more.
I feel the situation will grow rather worse than Rodgers expects, and that breakage of sites created months or years ago, angry phone calls by clients who rightly demand an immediate solution, 120 hour weeks, and frantic mails to CSS lists will become a common feature of life for hack-happy web developers in the first few months after IE 7's final release.
Even if you weather this crisis, it's only a matter of time before other browser vendors start doing the same thing, and you're forced to rewrite your Opera, Mozilla or Safari hacks.
A wonderful mess, isn't it? Take my advice and stop using CSS hacks right now, except for the very few safe ones. It won't help sites you've already delivered, but it will prevent you from having to recode your current sites in a few months.
I’m around at the following conferences:
Comments are closed.