# IE CSS, where to put the .htc file?

**URL:** <https://www.ruby-forum.com/t/ie-css-where-to-put-the-htc-file/88187>\
**Category:** Rails\
**Created:** [March 8, 2007, 8:15pm UTC](https://www.ruby-forum.com/t/ie-css-where-to-put-the-htc-file/88187 "2007-03-08T20:15:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 8, 2007, 8:15pm UTC](https://www.ruby-forum.com/t/ie-css-where-to-put-the-htc-file/88187/1 "2007-03-08T20:15:58Z")

</div>

HI,

I try to create a very simple menu with CSS in IE (and I always use  
firefox) but I have to make the web application compatible with IE ☹  
…  
I realize the :hover is not working on

 and - in IE, I have to  
put a line in the body in css

body {behavior:url(csshover.htc);}

and I have not idea where should I put this file, (the file contains JS  
that allow the :hover on any element in html… the file is form Eric  
meyer.

does some one know where and how should I put the file???

Thanks you very much

Sayoyo

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 8, 2007, 8:23pm UTC](https://www.ruby-forum.com/t/ie-css-where-to-put-the-htc-file/88187/2 "2007-03-08T20:23:54Z")

</div>

Put it in the same folder as your css file. The syntax url(csshover.htc)  
will look for the file in the same folder as itself.

## Thanks,

Scott B.  
Electro Interactive, Inc.  
Office: 813-333-5508  
[http://www.ElectroInteractive.com](http://www.ElectroInteractive.com) [http://www.electrointeractive.com/](http://www.electrointeractive.com/)

On 3/8/07, sayoyo [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> body {behavior:url(csshover.htc);}
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Scott B.  
Electro Interactive, Inc.  
Office: 813-333-5508

> **[Electro Interactive - Web Development. Ruby on Rails. Web Standards.](http://www.electrointeractive.com)**
>
> Electro Interactive is a full service new media design and development company.

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 8, 2007, 8:49pm UTC](https://www.ruby-forum.com/t/ie-css-where-to-put-the-htc-file/88187/3 "2007-03-08T20:49:28Z")

</div>

Hi, Scott

I have already try to put it in the public/stylesheets/, but it doesn’t  
work…

any idea?

thanks you very much!!!

Sayoyo

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 8, 2007, 8:59pm UTC](https://www.ruby-forum.com/t/ie-css-where-to-put-the-htc-file/88187/4 "2007-03-08T20:59:58Z")

</div>

Sayoyo,

Change it to read:

behavior: url(/stylesheets/csshover.htc);

Also, inside csshover.htc, it might refer to a ‘blank.gif’ somewhere. If  
so,  
make sure this file exists in your public/images directory and change  
the  
url within csshover.htc to ‘/images/blank.gif’

Mine is called iepngfix.htc and it has this as line 14:  
if (typeof blankImg == ‘undefined’) var blankImg = ‘/images/blank.gif’;

## Thanks,

Scott B.  
Electro Interactive, Inc.  
Office: 813-333-5508

> **[Electro Interactive - Web Development. Ruby on Rails. Web Standards.](http://www.electrointeractive.com)**
>
> Electro Interactive is a full service new media design and development company.

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 9, 2007, 12:46am UTC](https://www.ruby-forum.com/t/ie-css-where-to-put-the-htc-file/88187/5 "2007-03-09T00:46:34Z")

</div>

It might be worth pointing out that it was failing because of Routes,  
not CSS. The CSS was behaving exactly as it should on both counts.  
Basically, you have routes to your assets setup for you behind the  
scenes. At least, I would put money on this guess… check your logs  
with out the absolute path and see if there are routing errors.

In other news, you might like to know that you can do CSS menus with  
_standard_ JS fallbacks for IE. Suckerfish has been around for a good  
few years or more. There are surely other alternatives.

I think I used an .htc file once like four years ago…

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 11, 2007, 11:02pm UTC](https://www.ruby-forum.com/t/ie-css-where-to-put-the-htc-file/88187/6 "2007-03-11T23:02:03Z")

</div>

On 3/8/07, Seth Thomas R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> In other news, you might like to know that you can do CSS menus with  
> _standard_ JS fallbacks for IE. Suckerfish has been around for a good  
> few years or more. There are surely other alternatives.

I believe Sayoyo is using the .htc for fixing PNG alpha transparency in  
IE6,  
not for CSS menus. There are other alternatives with pure JS to do the  
fix,  
but you have to re-run it again any time a new transparent PNG is  
inserted  
into the page. This is the easiest, most unobtrusive approach I’ve found

- a  
css one-liner ( behavior: url(iepngfix.htc) ) that gets applied to any  
element that applies to the css selector. No special JS to run in the  
onload event of your pages, or when a new image is created or inserted  
in  
the DOM, as long as a css style is defined for it - it just works.

–  
Scott B.  
Electro Interactive, Inc.  
Office: 813-333-5508

> **[Electro Interactive - Web Development. Ruby on Rails. Web Standards.](http://www.electrointeractive.com)**
>
> Electro Interactive is a full service new media design and development company.

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 8, 2007, 9:37pm UTC](https://www.ruby-forum.com/t/ie-css-where-to-put-the-htc-file/88187/7 "2007-03-08T21:37:50Z")

</div>

Hi, Scott,

by adding “/stylesheet/”, now the css is able to find the .htc, Thanks  
you very much!!! and another thing I have changed is the .htc file  
given by Eric Meyer, he used :media =\> ‘screen’, and I was using :media  
=\>‘all’, it has created a problem too, now I have changed my code, my  
menu is shown correctly now,

Thanks you very much for your help!!!

Sayoyo
