IE6 Hover Issue

The CSS :hover doesn't work in IE6 for elements that are not links. Is there a workaround? e.g. how do I apply the :hover to a div?



There's whatever:hover. I've never used it myself but from what I hear, it works well.

Whatever:hover is a small script that automatically patches :hover, :active and :focus for IE6, IE7 and IE8 quirks, letting you use them like you would in any other browser. Version 3 introduces ajax support, meaning that any html that gets inserted into the document via javascript will also trigger :hover, :active and :focus styles in IE.


You can use the famous IE7.js from Dean Edwards, which has the nice advantage, that you can use the :hover selector in your CSS.

Apart from that, I doubt that you can achieve it with CSS alone. IE can handle JS in CSS files via expression(), but you can't get to an expression to handle hovering without a selector handling hovering, if you catch my drift.

Then, finally, a short jQuery solution:

$(document).ready(function () {
  $('div').hover(function () {
  }, function () {

Then you can use this in your stylesheet:

div:hover, div.hover { ... }
  • If you only need for paticulars div and you are not using jquery then go for suckerfis js as @futta suggested.
  • If you are planning to use Hover on more tags in future and don't want to edit every time js for this the go for in for IE6. as @Pekka suggested.
Suckerfish vs. .htc

IIIIN the blue corner we have Suckerfish, the original lightweight, accessible, cross-browser, standards-compliant :hover mimic. IIIIN the red corner we have '.htc' - the JavaScript files accessed via CSS to mimic :hover.

Ding ding!

And Suckerfish instantly lands a heavy blow on .htc's validity - .htc simply isn't standards compliant CSS.

Oooo... .htc sneaks in a crafty jab without the need for additional selectors...

Suckerfish bounces around the ring. He's much lighter weight than his opponent.

And OH! The IE 5.0 uppercut! That's something that .htc just doesn't have the skill to do, whereas Suckerfish can work IE 5.0 seamlessly.

.htc is dazed! And the contest is over! Suckerfish wins on points! TKO!

NO pure and valid CSS solution available for this in IE6.


suckerfish and it's offspring provde great lightweight alternatives for this purpose too.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.