ITeye博客

透明度的兼容写法总结

dreaming. · 2014-05-23 17:46 · Html · Web前端 · Markdown

<style type="text/css">

 

.tou{width:100px; height:100px;background-color:#999; filter:alpha(opacity=20);opacity:0.2;}

</style>

 

<div class="tou">透明层</div>

 

*********************************************

解释:filter:alpha(opacity=20) 是针对IE的,不写, IE9中可以,但在 IE9 以下(IE8,IE7,IE6)的浏览器都不行。

opacity:0.2 是针对火狐,谷歌的。

我一直以为 filter:alpha(opacity=20)这种写法不兼容IE6,因为我在IETest上测试不可以。后来在xp系统IE6上测试,却可以。说明IETest的IE6有Bug。

 

使用时这两种一定要全部写,才兼容各种浏览器。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。