473,385 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PNG loses transparency when opacity filter is applied in IE7

Unicron
Hi everyone. The title says it all.

I have a collection of PNGs with drop shadows. They work great in IE7 and FF.
If I add filters in my stylesheets, such as

icon {
filter: alpha(opacity=10);
-moz-opacity: .10;
opacity: .10;
}

then the PNG shadows all turn into solid black pixels (even If I say opacity 100).
Has anyone ever dealt with this issue? This is for an internal application for use by only a few dozen people, so I am not against hacks.
Feb 18 '08 #1
4 3135
drhowarddrfine
7,435 Expert 4TB
IE6 has never worked with alpha transparency on png although ALL other browsers have for years. IE7 does though. Here is one hack to fix IE.

btw, modern browsers understand 'opacity' so it's not necessary to use '-moz-opacity'
Feb 18 '08 #2
Thanks for the reply. I will drop the -moz line.

I had actually already looked at that hack from a google search, but I didn't think that applied as it was meant for IE6, which we don't use.

IE7 displays transparent PNGs just fine unless the filter is applied, regardless of whether its from a stylesheet or a javascript event handler.

For example, I have a button that toggles the icon to 10% opacity. It loads fine with a shadow, then you hit the button and the shadow of the icon suddenly turns solid. If I toggle it back to 100%, the image is still solid.

If I can't get it working, there's always Flash.
Feb 18 '08 #3
drhowarddrfine
7,435 Expert 4TB
I don't know how I got IE6 out of that.

I don't know anything about 'filters' either as I would never use them.
Feb 18 '08 #4
hsriat
1,654 Expert 1GB
I think there's a problem with IE7 displaying PNGs.

Make a PNG image (w/o alpha) and then save it as GIF or JPG.
Embed them together in an HTML file and open it in IE7.
There would be a difference in the colors of PNG from GIF (or JPG) while in Firefox, they'll look same.



But talking about filters, the DOM for images' filters are different in IE from others..

IE - imageObject.style.filter.opacity = 0 to 100
Others - imageObject.style.opacity = 0.00 to 1.00
Feb 18 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Simon | last post by:
In IE I have a routine that dynamically assigns objects' opacity. This works fine for some elements but not for others. It works for buttons and inputs but not for img, span and select. This is...
3
by: Marek Mänd | last post by:
This posting will express my concern about the future of css3 forthcoming recommendation. I think for long time now, that the current implementation of CSS attribute opacity is less than usable...
2
by: mattaku | last post by:
I have a background image for my form that has an alpha channel (PNG or GIF). I would like my form to become semi-transparent and partially show the desktop. I can figure out how to set the form's...
1
by: chris | last post by:
I've used JavaScript DOM scripting to create a table element and alter its opacity. Bizarrely, the contents of the table appear to vanish when the opacity changes. One important note is that I...
12
by: Patrick Dugan | last post by:
I know that I can change the opacity of an entire form, but is there a way to control opacity to specific controls or components? For example I want to create a form that is semi-transparent...
1
by: dave | last post by:
I am attempted to make a semi-transparent div in IE/Firefox but IE is only making the first image in the div opaque for example if I have a div like: <div class='trans'><img src="foo.jpg"><img...
2
by: ivowel | last post by:
Dear Experts: I am trying to write a css style that makes text invisible; visible-when-selected (so that at least a visible block appears over the selected text---like black foreground over...
15
by: Sunny | last post by:
Hi, I can change the lement opacity in IE using. abc.style.filter = 'alpha(opacity=' + 10 + ')'; But this dont work in firefox, In firefox it throws error. How I can change the opacity of an...
8
by: mfaisalwarraich | last post by:
Hello, I am using the following method in CSS to make a PNG image transparency preserved: opacity:0.5; filter:alpha(opacity=50);
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.