IE7 CSS Fixes Not All Bad

In case you weren’t aware of it already, in IE 7 the * html hack to target CSS to only IE browsers no longer works. This means any rules assigned to a selector that begins with * html will not be applied by IE7.

This is going to annoy a lot of people (such as myself) who rely on these hacks.

However I found a positive experience that comes from this change I thought I’d share.

I’m working on a new CSS-based dropdown menu system (as you know by now). And to get IE6 and earlier working with this system I had to employ the suckerfish method. This is because IE6 and earlier do not support the :hover pseudoclass. Well IE7 does support the :hover pseudoclass and running the suckerfish script under IE7 starts to make things goofy. So as a result, I had to update the script to not execute under IE7 and later.

But here’s the thing.

All the CSS applied to sfhover class is defined using the * html hack. This means, in actuality, I don’t have to go and modify the suckerfish code at all. I can let it continue to execute under IE7 and nothing bad happens. The only drawback is that you add needless overhead to processes the mouseover and mouseout events in IE7.

Now some of you might start to think “ah hah! maybe we can use the sfhover class for something else in IE7. since we’re running it anyway for IE6.” But no, you’d be wrong.

Why?

Because the goal is to get as far away from javascript as possible. We simply have no choice with IE6 and earlier. We have to work around the browser’s limitations.

The potential is there that if a bug does crop up in the final release of IE7 that requires us to utilize the opportunity, so be it. But it isn’t something we should bother taking advantage of unless absolutely necessary. Otherwise we’re just locking ourselves into javascript for the foreseeable future.

Advertisements

2 thoughts on “IE7 CSS Fixes Not All Bad

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s