Results 1 to 4 of 4

Thread: PNG Transparency Lost When Used With Opacity/Alpha

  1. #1
    Join Date
    Oct 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PNG Transparency Lost When Used With Opacity/Alpha

    I'm trying to use a semi transparent PNG and have found that when using opacity/alpha the transparency of the PNG is lost in Internet Explorer. It works fine in Firefox but goes solid in IE.

    A small small example of the problem is shown below, shadow.png would be a semi transparent drop-shadow which works fine normally, but breaks when I apply opacity/alpha. I need to use opacity/alpha as I'm fading an error message div in and out when required.

    If anyone knows how to keep the PNG transparency when used with opacity/alpha, please help.

    Thanks

    Code:
    <html>
    <head>
    	<style type="text/css">
    		img {
    			opacity: 0.25;
    			filter: alpha(opacity=25);
    		}	
    	</style>
    </head>
    <body>
    	<img src="shadow.png" />
    </body>
    </html>

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Are you talking about IE6 or IE7?

  3. #3
    Join Date
    Jul 2008
    Location
    Serbia
    Posts
    47
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default

    Code:
    <style type="text/css" media="screen">
    #logo{
        height: 90px;
        width: 280px;
        background:url("shadow.png") 0 0 no-repeat;
    }
    *html #logo {
        background:none;
        filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='shadow.png', sizingMethod='image');
    }
    </style>
    Then call this:

    Code:
    <div id="logo"></div>
    Replace #logo with your on DIV ID and set right height and width....

    This will do the job!!!!

    Or you can try this

    IPNG FIX for this read manual....
    Last edited by bokanegro; 10-30-2008 at 12:39 PM.

  4. #4
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default

    Code:
    <style type="text/css" media="screen">
    #logo{
        height: 90px;
        width: 280px;
        background:url("shadow.png") 0 0 no-repeat;
    }
    *html #logo {
        background:none;
        filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='shadow.png', sizingMethod='image');
    }
    </style>
    That would put unnecessary strain on IE7...

    You should use something like this to exclude this code from IE7:

    Code:
    <!--[if IE lte 6]>
    <style type="text/css">
    #logo{
        height: 90px;
        width: 280px;
        background:url("shadow.png") 0 0 no-repeat;
    }
    *html #logo {
        background:none;
        filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='shadow.png', sizingMethod='image');
    }
    </style>
    <![endif]-->
    --------------------------------------------------
    Reviews, Interviews, Tutorials, and STUFF
    --------------------------------------------------
    Home of the SexyBookmarks WordPress plugin

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •