Posted By

AshMan on 04/17/09


hack png ie6

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


IE6 Only CSS. Also make IE6 use PNG backgrounds

 / Published in: CSS

Since there are still many people using IE6, we have to cater for them :-( Anyway, this CSS statement shows a declaration for a PNG Logo. Most browsers will understand the first 5 lines. Sadly, IE6 will not be able to use the transparent PNG from line 4 and we override the background declaration by using the "" at the beginning of line 7 (all other browsers ignore the ""). Then we use the MS filter in lie 8 to insert the PNG image.

  1. #Logo{
  2. Width: 100px;
  3. Height: 100px;
  4. Background-Image: URL("Logo.png");
  5. Background-Repeat: No-Repeat;
  6. /*---IE6 Only--*/
  7. _Background-Image: URL("");
  8. Filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='Logo.png', sizingMethod='scale');
  9. /*-/-IE6 Only--*/
  10. }

Report this snippet  

You need to login to post a comment.