Favorite IE6 PNG hack?

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

anyone have a favorite? I need one that works for bg images as well as regular IMG tags.
  • jameson5555
  • Bronze Robot
  • Bronze Member
  • User avatar
  • Posts: 575
  • Loc: Phoenix, AZ

Post 3+ Months Ago

I always use the iepngfix, but I haven't been able to make it work for background images.

Just waiting for ie6 to die a slow, painful death before I bust out the really tricky CSS moves. 8)
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

A conditional comment that tells IE6 not to use the PNG version of a background image, with a GIF version of the image defined beforehand.

Code: [ Select ]
.classname
{
   background: url('image.gif');
}
</style>
<!-- or defined via style.css -->
 
<!--[if gte IE 7]>
<style type="text/csss">
.classname
{
   background: url('image.png');
}
</style>
<![endif]-->
  1. .classname
  2. {
  3.    background: url('image.gif');
  4. }
  5. </style>
  6. <!-- or defined via style.css -->
  7.  
  8. <!--[if gte IE 7]>
  9. <style type="text/csss">
  10. .classname
  11. {
  12.    background: url('image.png');
  13. }
  14. </style>
  15. <![endif]-->


As for images themselves, search real quick to see it there's been any new developments on technique then go with the first solid looking one.

Been awhile since I've done anything where it would matter though. :|
  • crazzyDemon
  • Beginner
  • Beginner
  • User avatar
  • Posts: 55

Post 3+ Months Ago

Usually i use this method
http://homepage.ntlworld.com/bobosola/

but id does not work for background image =(
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

yeah I had a javascript one that I built but it doesn't do backgrounds either. I plugged this one into my site but it doesn't seem to have any affect what so ever. Hence the question about what other people are using...
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23460
  • Loc: Woodbridge VA

Post 3+ Months Ago

Check this out

http://www.civicactions.com/blog/png_im ... eming_hell
  • HongKongPhooey
  • Student
  • Student
  • User avatar
  • Posts: 86
  • Loc: Liverpool

Post 3+ Months Ago

graphixboy wrote:
yeah I had a javascript one that I built but it doesn't do backgrounds either. I plugged this one into my site but it doesn't seem to have any affect what so ever. Hence the question about what other people are using...


Did you ever get this problem sorted?

The "fix" you mention in your post definitely works ... I've just finished implementing it into a new design and it works a treat.

If you need any help, let me know. 8)
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

Nope I haven't gotten it fixed yet. Although admittedly I haven't had much time to spend on it. I've used several different fixes on other sites and can't figure out why this one doesn't seem to work.

The site in question is http://whenimnotsleeping.com. Feel free to take a look. I assume the issue is simply a path thing, but I have a lot of other JS in there so something might be conflicting with the page load functions...
  • HongKongPhooey
  • Student
  • Student
  • User avatar
  • Posts: 86
  • Loc: Liverpool

Post 3+ Months Ago

Just a couple of quick lunchtime thoughts ...

Is the "iepngfix.htc" file in the root of your site (or at least in the same folder as the homepage)?

It's referenced in your IE6 stylesheet as being in the same folder as the html page. I tried to access it and got a 404 error, but there could be other reasons for this.

Also, I found out that "the fix" plays up with relatively and absolutely positioned elements. I had to remove the 'position' declaration and resort to floats to get mine to work correctly.

I hope something helps ... if not I'll take another look when I've got a bit more time. :)
  • jameson5555
  • Bronze Robot
  • Bronze Member
  • User avatar
  • Posts: 575
  • Loc: Phoenix, AZ

Post 3+ Months Ago

HongKongPhooey wrote:
Also, I found out that "the fix" plays up with relatively and absolutely positioned elements. I had to remove the 'position' declaration and resort to floats to get mine to work correctly.

I didn't know that.. maybe that's why I wasn't able to get it to work for background images on my sites.

Also, it's worth mentioning that the guy who wrote the iepngfix is really helpful. When I was first trying to figure it out, I asked some questions on his message board and he helped me figure out what I was doing wrong.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

HongKongPhooey wrote:
Is the "iepngfix.htc" file in the root of your site (or at least in the same folder as the homepage)?

... probably not at the moment. I was thinking it might be a path issue so I moved it around trying to get something to happen.

However, I think your onto something with the positioned elements. Unfortunately my layout requires that so I'm going to have to find a work around. Maybe its time to contact the author (thanks for the tip jameson)
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

Thanks for the help all. Its resolved. Turns out I'm an Idiot :-) My IE 6 only stylesheet (that contained the PNG fix call) wasn't actually loading since I didn't close the if statement correctly.

Once I fixed the if statement and the png fix actually loaded I did have to mess with backgrounds and absolute positioning a little bit by removing png's in a few places.
  • HongKongPhooey
  • Student
  • Student
  • User avatar
  • Posts: 86
  • Loc: Liverpool

Post 3+ Months Ago

Good to hear you've got it sorted.

Post Information

  • Total Posts in this topic: 13 posts
  • Users browsing this forum: No registered users and 17 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.