...

View Full Version : :hover commands for any element in CSS, in IE



whizard
02-11-2005, 04:06 PM
:::WAIT:::

before you judge this thread by the title (although thats usually a good thing to judge it by) let me say this: I am NOT asking how to do this. I am telling you about a way that you can apply the hover psuedo thing to ANY element in IE!!!

(You may all know this already, you people are so smart)

I just found an .htc file on this site: http://www.xs4all.nl/~peterned/csshover.html that allows you to apply the hover psuedo class to any element.

all you do is upload it to your server and then add the following line in your <body> tag:
style="behavior:url(csshover.htc)"

or you can probably put it in css, but I wasnt sure how.

Dan

chilipie
02-11-2005, 04:38 PM
all you do is upload it to your server and then add the following line in your <body> tag:
style="behavior:url(csshover.htc)"

or you can probably put it in css, but I wasnt sure how.

This would probably be the best way to do it:


<!--[if IE]>
<style type="text/css">
body {
behavior: url(csshover.htc);
}
</style>
<[end if]-->

The "behavior" attribute is not valid CSS, so if you use conditional comments the page will still validate.

I now have 666 posts :eek: . It's the devil! :D

whizard
02-11-2005, 04:52 PM
It doesnt matter if the browser is IE or not. Other browsers dont support htc behaviors

Dan

chilipie
02-11-2005, 05:01 PM
It doesnt matter if the browser is IE or not. Other browsers dont support htc behaviors

That wasn't the point I was making - the "behavior" attribute is not valid CSS, so unless you use the condtional comments, the page will not validate.

whizard
02-11-2005, 05:27 PM
oh. i get it.

Dan

rmedek
02-11-2005, 08:34 PM
I've read that article, but I've never tried it out because of this bit:


NOTE: The rules for HTCs have changed a bit in Windows XP SP2. Users with SP2 installed may not see it working correctly, because webservers have to send htc files with the mime-type set to text/x-component.

There's a link to a blog that documents it, but I never got that far... too busy sighing and moving on :D

If you like that, you'll appreciate this link, too :

http://www.doxdesk.com/software/js/minmax.html

It's a great little JS bit that forces IE into supoorting min/max width and height.

(this is actually a good idea for a new thread/sticky if you ask me... tools and hacks for IE)

chilipie
02-11-2005, 08:38 PM
If you like that, you'll appreciate this link, too :

http://www.doxdesk.com/software/js/minmax.html

It's a great little JS bit that forces IE into supoorting min/max width and height.

Bookmarked :) .

whizard
02-11-2005, 08:51 PM
I have SP2 and am using Abyss Web Server to test on local, but I have not encountered any problems with this .htc file. It works on EVERYTHING. its awesome!

Dan

Zac
02-21-2005, 03:01 PM
Hi,

After implementing your suggested solution using the htc file, I found with <base href> on the page hover only works for clients coming into the site through that domain, e.g if <base href="xx.com"> and people enter my site through xx.co.uk then hover still does not work.

I would be greatful if you could suggest any possible solutions.

Many thanks for your help,

Zac

rmedek
02-22-2005, 12:37 AM
Why not just drop <base> from the meta tags?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum