Code Snippets

CSS pseudoclass :hover for IE

2010/05/26 | Comment?

IE6 and IE7 in quirks mode don’t support :hover pseudoclass for non-anchor (<a>) elements.

This little css trick can workaround the problem (example on a <tr> element):

tr { background: #ffffff; hover:expression(this.onmouseover=new Function("this.style.background='#ff0000';"),this.onmouseout=new Function("this.style.background='#ffffff';")); }
tr:hover { background:#ff0000; }

First line define background color for generic <tr> element and implement hover behaviour for IE, second line catch hover for standard-compliant browsers.

Share and Enjoy:
  • Tumblr
  • Twitter
  • FriendFeed
  • Digg
  • StumbleUpon
  • del.icio.us
  • Technorati
  • Sphinn
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • RSS
Tags: , ,

have your say

:

:


«
»