# 今更だけど透過PNG対策。

- リンク: https://torounit.com/blog/%e4%bb%8a%e6%9b%b4%e3%81%a0%e3%81%91%e3%81%a9%e9%80%8f%e9%81%8epng%e5%af%be%e7%ad%96%e3%80%82/
- 公開日: 2009-10-16T15:35:37+09:00
- 作成者: Toro\_Unit

背景に指定するときは

[css]behavior: expression(
 this.style.behavior || ( this.style.filter = "progid:
DXImageTransform.Microsoft.AlphaImageLoader( sizingMethod = crop,src = ‘"+this.currentStyle.
getAttribute("backgroundImage").slice(5,-2)+"’ )", this.style.backgroundImage = "
none", this.style.behavior = "none"[/css]

imgに直接やる場合は

xhtml

[xhtml]
 <div> <a href="#"> <img src="hoge.png" alt="" width="200" height="100" /
> </a></div> [/xhtml]

css

[css]
 * html div{ filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src
=hoge.png); width:200px; height:100px; } * html div a img {display:none;} [/css]

なんて書いてやる。

filterで透過PNGを表示させて、通常のPNGをdisplay:noneで消す。
 面倒ですね・・・・

ってなわけで通常は[IE PNG Fix 2.0 Alpha 4](http://www.twinhelix.com/css/iepngfix/)
をワタクシは使ってます。
