:hover pseudo class and evil IE!
Published December 10th, 2009 under General
:hover pseudo class
Suckerfish and conditionals
The suckerfish script is the standard script used to add the same effect as the :hover pseudo class in IE6. In the past, it was common place to simply load the file for every page load, however now that IE6 does not have a 90%+ hold on the browser market place it is advisable to only serve the scripts to those browsers that need it. The best way to serve the file only to those older browsers is to place a link to an external script via IE conditional comments like this:
[code lang=”html”]<!–[if lte IE 7]>
You could alternatively include the code directly on the page itself, but this increases the page load slightly for all browsers rather than just limiting it to the old clunkers like IE6. With conditionals you can save quite a few lines of code on every page load.
Once you have a Suckerfish script running on your page, you can apply a class (usually .sfhover for most scripts) to the CSS and use that for IE6 instead of the :hover pseudo class.
Why we need to use IE7, not IE6 conditionals
Coming soon will be a blog post about alternatives to the Suckerfish script, the best versions to use and how to setup your custom HTML.