Let's be honest...  IE6 is nobody's favorite browser, least of all a web designer.  Most of us have learned to live with it, however, as it still taints a large section of the browsing community. 

The issues are numerous. The peek-a-boo bug and poor CSS 2.0 support being at the forefront.  With the help of my business partner, we have stumbled across a solution to one of the most frustrating IE6 features (or lask there of): the lack of :hover pseudo class support.  The :hover class is an extremely useful gem in any web designer's treasure chest, allowing them to communicate with the user as they mouse around.  Now we can extend that conversation to include the viewers using the seemingly immortal Internet Explorer 6.

The solution:

We must start with Peter Nederlof's Whatever:hover. It is a patch for IE6 written in a text file called an .htc file (HTML Component).  Simply save the file in your site.  I prefer to keep it in a themes folder with my style sheet(s).  You link the file in your CSS on the body element using the behavior tag:

body { behavior: url("./Themes/csshover3.htc"); }

Simple enough, right?

For most static designs, this works just fine. However, due to the relative nature of the link, any sites using URL re-writing of any kind, MVC for example, will find that it is very difficult to make sure all of your pages can locate the file.

We primarily create sites in .NET/C# and use a ASP.Net Master Page. We link the .htc file in the <head> tag of the Master Page like this:

<!--[if lte IE 6] >
  <style>
    body { behavior:url('<%=ResolveUrl("~/themes/csshover.htc") %>'); }
  </style>
<![endif]-->

Notice that we are only linking the .htc file for IE6 or less, as it is not needed for other browsers. This is a great place to link IE6-specific style sheets to take care of any other design nuisances  as well.

The ResolveUrl in the url will tell the server to start it's search in the root directory of the site and follow the path from there. That way it doesn't matter where the page thinks it is, it will always be able to locate the .htc file.

A special thank you to Peter Nederlof for this great solution to a very frustrating bug!