Topic: CSS Transparent Rollovers |
|
---|---|
Author | Thread |
Nervous Wreck (II) Inmate From: Texas |
posted 05-02-2004 03:54
've seen tons of nifty flash rollovers that use partial transparency to highlight a link or button while still showing the background. Since I can't fit my head around flash, I decided to see if I couldn't do the same thing with CSS. I've come up with an excellent, compliant solution that works in IE, Mozilla, and Opera. How often does that happen? The secret lies in the image. At first I tried using a PNG-24 image with 50% transparency. IE didn't like that, but I ran into an interesting glitch some browsers have with .pngs. Instead of making them transparent, they dither them. |
Paranoid (IV) Inmate From: A graveyard of dreams |
posted 05-03-2004 23:41
Nice |
Nervous Wreck (II) Inmate From: Texas |
posted 05-05-2004 21:54
*nods* I know a little bit about the 'filters' that IE supports. I don't know enough about them to use them in this fashion though. Besides, like you said, it ruins compliance. Which isn't a huge deal, but since you can be compliant and acheive the effect, why not? Thanks for the compliment. I was pretty proud of this little tech. |
Paranoid (IV) Inmate From: France |
posted 05-05-2004 22:06
Otherwise you could use a bit of server side code to filter the userAgents and provide a PNG for the standard compliant browsers and a dithered GIF for the others. To do so you could either generated a CSS depending of the browser, or simply put your server side script in the background-image attribute. |
Nervous Wreck (II) Inmate From: Texas |
posted 05-06-2004 20:52
Yep. I think I could write a bit of PHP to do just that. Thats a great idea if the transparency was more complex, the dithering stops looking so great on a gradient. I could serve up a nice .png image to those using a halfass browser and stick the IE people with a dithered gif. But the gif works great for this. And it's only 36 bytes so the download is near instantaneous. |
Paranoid (IV) Inmate From: France |
posted 05-06-2004 21:14 |
Nervous Wreck (II) Inmate From: Texas |
posted 05-06-2004 21:37
Animated how? Just alternate the transparent and non-transparent pixels? And wouldn't that trick your eye into seeing a solid white block? In anycase I'll have to try it. Thanks! |
Paranoid (IV) Inmate From: France |
posted 05-06-2004 22:10 |