Monday, April 14, 2008

IE6 PNG Transparency Problem

I been working on redisigning a couple of Web site and have come across a very serious problem. I created an image to be place as the background of a div. I then went ahead and included the company logo as a transparant PNG file. Everything was going great. I normally develop in Internet Explorer 7, but make sure to test on all other browsers, Firefox, Netscape, AOL, and Safari.

Turns out during my testing I forgot one, Internet Explorer 6. Well it came to bite me in the butt. When I pulled up the site, the logo was there, but to my surprise it had a grey background instead of the expected transparent background.

After many javascript and conditional comments trials, I decided to incorporate the logo onto the background image. The problem came in that I needed that logo to serve as a hot link to the Web site homepage.

The answer was simple, I created a div inside the div containing the background image and gave it absolute positioning with an onclick command. Here is the code:



The bottom line is that when problems seem complex, the main key is not to panic but to walk away from it for a few minutes and come up with a solution. At first glance, I became quite frustrated, but I turned to work on something else, an hour later, the solution hit me. Hope this helps you as well.

Labels: , , ,

Digg This Del.icio.us Slashdot

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home