Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Sébastien Grosjean

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

PNG-24 Alpha support for IE

What so much webdesigners dream about!
Get alpha channel on web, that's possible with PNG-24 images and this trick.
BE CAREFUL: that seem to work only for 10 images per page.

  # Display PNG-24 images with alpha channel on IE
  # BE CAREFUL: with this trick, only 10 PNGs seems to be supported by IE
  # Don't forget to set the size of your div
  def transpng(id, png)
    '<style type="text/css">
      <!--
        ' + id + ' {
          background-image: url(' + png + ');
        }
      -->
    </style>
    <!--[if IE]>
    <style>
      ' + id + ' {
        background-image: none;
        filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + png + ', sizingMethod=\'scale\');
      }
    </style>
    <![endif]-->'
  end
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS