Is there a JavaScript PNG fix for IE6 that allows CSS background positioning?

前端 未结 6 985
你的背包
你的背包 2021-02-05 21:24

I\'ve seen a few fixes for allowing PNG images to have transparency in Internet Explorer 6, but I\'ve yet to find one that also allows you to set the background position in CSS.

相关标签:
6条回答
  • 2021-02-05 22:02

    Yes. Convert your images to use indexed pallets (png256). You can support transparency (just like gif), but not an alpha channel.

    You can do this using Irfanview and the pngout plugin, pngquant or pngnq.

    The YUI performance team also did a great presentation that covers this an many other image optimization concepts.

    0 讨论(0)
  • 2021-02-05 22:02

    When the background is static I use TweakPNG to change the Background Color chunk in the PNG to the correct color (instead of the default gray color). Any regular browser will ignore this because the alpha channel overrules it, but IE6 and lower will use that color instead of the alpha channel.

    This means we have transparency in IE7+ while degrading nicely in IE6 and lower. And all css positioning and repeating are possible (because there are no hacks!).

    0 讨论(0)
  • 2021-02-05 22:07

    DD_belatedPNG.js works very well

    0 讨论(0)
  • 2021-02-05 22:15

    You can actually use pure CSS to get positioned background images with alpha transparency in IE6 by taking advantage of IE6's alpha filters and the CSS clip property. Julien Lecomte describes the technique on his blog.

    Note that this technique does result in a performance hit for each use of an alpha filter.

    0 讨论(0)
  • 2021-02-05 22:21

    This is a new technique that has popped up in the last month or so. From the page:

    In this script image tags are supported, both with and without a blank spacer GIF, and background image PNGs may be positioned, as well as repeated, even if they're smaller than the content element they're in.

    0 讨论(0)
  • 2021-02-05 22:28

    IE PNG Fix v2.0 has support for full alpha+position/repeat.

    0 讨论(0)
提交回复
热议问题