Jump to content

PNG Transparency Issue


yakabod

Recommended Posts

I followed this:

 

http://msdn2.microsoft.com/en-us/library/ms532920.aspx

 

It works great on IE as stated but going in firefox or opera, my image disappears.  Why is that?

 

I used to have the image in my css stylesheet as a background but removed it because of the PNG Transparency.  So I made the changes from that link above and as I said earlier, it works great in IE but firefox and opera the image does not show. So, I go back to the css stylesheet and add back the background code and checking firefox and opera it works great, then again going to IE it has the grayscale. 

 

Is there a way to not show the css stylesheet code on IE, but have the alphaimageloader visible for IE? 

 

Thank you.

Link to comment
Share on other sites

You need to use a conditional stylesheet for IE so that the browsers supporting png transparency work properly while IE falls back on that horrible alphaimageloader. Take all the code needed to get the alphaimageloader working and stick it in a separate stylesheet (e.g. called ie.css) that you link to in the head of your document, like this:

 

<!--[if lte IE 6]>
<link rel="stylesheet" media="screen" type="text/css" href="/ie.css" />
<![endif]-->

 

The lte means "less than or equal to". You can see more about conditional comments here - http://msdn2.microsoft.com/en-us/library/ms537512.aspx

 

But where possible avoid using images that require semi-transparent areas. Often you can just use a jpg/gif with the transparent effect but no actual transparency being required by the browser. Or, if you have Fireworks, you can use png-8 to get around the problem of transparency in lte IE6 altogether - http://www.sitepoint.com/newsletter/viewissue.php?id=5&issue=37#5

Link to comment
Share on other sites

ToonMariner, PNG-24 will come up as a grey box in IE6 if the image uses alpha-transparencies. To avoid using all the IE proprietary crap needed for transparencies, you can use Fireworks to save the image in the PNG-8 format with alpha-transparency enabled. This will let Firefox, Opera, Safari, and IE7 display the semi-transparent parts of the image while IE6 simply ignores them but displays all the fully opaque parts. The is suitable for the vast majority of uses of semi-transparent images - IE6 users won't even realise they are missing out on something

 

The SitePoint article tells you everything you need to know.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.