在IE下使用的滤镜,可以实现很多不错的特效,但是在chrome和火狐opera等浏览器里这些就全都失效了,这是为什么呢?找了一下原来是因为 滤镜只是属于IE浏览器开发下的功能,不支持IE内核的浏览器也就都不支持这些滤镜。 不过一般都支持透明滤镜,只是写法不一样,如下:
要设置一下透明度为60%的DIV就应该这样写了:
div.transp { /* make the div translucent */
opacity: 0.6; /* Firefox, Safari(WebKit), Opera)
filter: "alpha(opacity=60)"; /* IE 8 */
filter: alpha(opacity=60); /* IE 4-7 */
zoom: 1; /* needed in IE up to version 7, or set width or height to trigger "hasLayout" */
}
filter: "alpha(opacity=60)"; /* IE 8 */ 为IE下写法,opacity: 0.6; 为火狐等浏览器下写法,所以要都支持这个滤镜,就得两个都写上(搞的这麻烦,看得出W3C标准规范化可以实现的好处了)
要设置一下透明度为60%的DIV就应该这样写了:
div.transp { /* make the div translucent */
opacity: 0.6; /* Firefox, Safari(WebKit), Opera)
filter: "alpha(opacity=60)"; /* IE 8 */
filter: alpha(opacity=60); /* IE 4-7 */
zoom: 1; /* needed in IE up to version 7, or set width or height to trigger "hasLayout" */
}
filter: "alpha(opacity=60)"; /* IE 8 */ 为IE下写法,opacity: 0.6; 为火狐等浏览器下写法,所以要都支持这个滤镜,就得两个都写上(搞的这麻烦,看得出W3C标准规范化可以实现的好处了)

