如何利用css使PNG圖片透明

來源:互聯網
上載者:User

  或許這本來是一個很簡單的問題,雖然偶主營業務不是CSS,也學習了一下,權做積累;如下代碼來實現png的透明

 

<style type="text/css">
#yes {
margin: 0 auto;
text-indent: -9999em;
width: 362;
height: 139;
background-image: url(images/2009_mayday.png);
background-repeat: no-repeat;
background-position: left;
_background: none;
_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://k.baobaoke.com/images/2009_mayday.png",sizingMethod="scale");
}
</style>

.....
<h1 id="yes" ></h1>

略作猜測:

 

由於IE6這個瀏覽器很個性,所以PNG圖片不支援透明,只好用濾鏡來實現。

至於這個濾鏡的作用,大家google一下吧。嘻嘻。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.