如何修复IE6中的png图像问题

How to fix png image issue in IE6?

本文关键字:图像 问题 png 中的 何修复 IE6      更新时间:2023-09-26

我知道互联网上有很多可用的方法,我找到了一种使用iepngfix的方法,但要解决这个问题,我需要为每个png图像指定宽度和高度,这对我来说太耗时了。因为我的项目中有1000个png图像,有没有任何方法可以解决这个问题而不为图像标签指定宽度和高

我的图像标签是:

<img src="myPngImage.png" width="120" height="100" />

你可能想看看CSSPie,我个人使用它,到目前为止它工作得很好。我没有在IE6中测试图像透明度,但似乎得到了很好的支持http://css3pie.com/documentation/supported-css3-features/#pie-png修复。

如果您必须支持IE6,那么我建议您使用类似jquery的功能(它将自动检测图像的宽度/高度)。

<!--[if IE 6]>
      <script src="js/DD_belatedPNG_0.0.8a-min.js" type="text/javascript"></script>
      <script type="text/javascript">
            DD_belatedPNG.fix('img,div,ul,li,li a,a,input,p,blockquote,span,h1,h2,h3');
      </script>
      <![endif]-->

从这里下载代码

http://trac.symfony-project.org/browser/plugins/pkToolkitPlugin/trunk/web/js/DD_belatedPNG_0.0.8a-min.js?rev=20453

customize-your-blogger.googlecode.com/files/DD_相关PNG_0.0.8a-min.js