トップ  »  CSS  »  IE6でpngを使う

2008年10月 7日

IE6でpngを使う

imgに適用

ie6png.gifというファイル名の透過gifをpngファイルと同じディレクトリにおかないといけない。


* html img{ /* IE-expression (first-child) */
behavior: expression(
this.style.filter = this.src.match(/\.png$/) ? "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "')" : this.style.filter,
this.src = this.src.match(/\.png$/) ? this.src.slice(0, this.src.lastIndexOf("/")+1) + "ie6png.gif" : this.src,
this.style.behavior = "none"
);
}

背景に適用


* html div{
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"
)
);
}


AlphaImageLoaderを使う

div{
background:url(○○.png);
}

* html div{
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='○○.png');
srcは、htmlファイルからのパスを指定(ルートパスが無難)
zoom:1;
}

* html div a{
cursor:pointer;
position:relative;
}

トラックバック(0)

このブログ記事を参照しているブログ一覧: IE6でpngを使う

このブログ記事に対するトラックバックURL: http://magic-happens.net/mt/mt-tb.cgi/35

コメントする

Top of Pageページの先頭へ

© Magic Happens