HTML and CSS   XSLT   JavaScript   Images   Soft   Etc  
Vladimir Tokmakov

Displaying PNG in IE January 2005


Task:

Display PNG images with transparency in IE.

Suggested below is a several step technique for  preparing images for web. It enables to reduce file size and display PNG fairly well in IE lower or equal to 5.5. Drawbacks: complexity and limited palette of GIF colors.

How it looks in the browser

Knorr ® + Knorr ® = Knorr ®
01 
02 
03 
04 
05 
06 
07 
08 
09 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
<style type="text/css">
    #body_png
    {
        background-image: url('grid-10.gif');
        padding: 1em;
    }
    #body_png img
    {
        vertical-align: middle;
    }
    .png
    {
        //background-image: none ! important;
        /*
            do not forget that expression
            behavior: url(...)
            requires absolute path
        */
        behavior: url('pngfix.htc');
    }
</style>
<div id="body_png">
    <img
        src="logo.png"
        width="175"
        height="135"
        alt="Knorr &reg;"
    />
    +
    <img
        src="logo.gif"
        width="175"
        height="135"
        alt="Knorr &reg;"
    />
    =
    <img
        src="logo.gif"
        style="background-image: url('logo.png');"
        class="png"
        width="175"
        height="135"
        alt="Knorr &reg;"
    />
</div>

Order a design...