css 透明度的设置兼容所有浏览器

枫树林给大地铺上了红色的地毯,秋风一吹,枫叶发出哗啦啦的响声,好似在鼓掌欢庆这丰收的景象。看,那菊花,它们开得多么热烈!距么旺盛!黄的、红的、白的、紫的……一朵朵,一簇簇,迎着秋风,披着寒霜,争妍斗艳,喷芳吐香,开得到处都是,简直成了一个锦簇的世界。
复制代码
代码如下:

.transparent_class {filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5; opacity: 0.5;}

UPDATE: I wanted to pull this post out of the archives and update it a bit because it there seems to be a good amount of interest in this subject.

Here is what each of those CSS properties is for:

  • opacity: 0.5; This is the “most important” one because it is the current standard in CSS. This will work in most versions of Firefox, Safari, and Opera. This would be all you need if all browsers supported current standards. Which, of course, they don’t.
  • filter:alpha(opacity=50); This one you need for IE.
  • -moz-opacity:0.5; You need this one to support way old school versions of the Mozilla browsers like Netscape Navigator.
  • -khtml-opacity: 0.5; This is for way old versions of Safari (1.x) when the rendering engine it was using was still referred to as KTHML, as opposed to the current WebKit.

来源:http://css-tricks.com/css-transparency-settings-for-all-broswers/
这个我就不想翻译了,很简单,我也只是为了做个记录。哈~~~

以上就是css 透明度的设置兼容所有浏览器。世上没有做不了的梦,只有太早醒的人,不管之前输过多少回,还有一颗想赢的心,就有希望。更多关于css 透明度的设置兼容所有浏览器请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
css让页脚保持在底部位置的四种方案

Flex布局史上最简单使用语法教程

新的CSS 伪类函数 :is() 和 :where()示例详解

纯CSS打字动画的如何实现示例

CSS浮动引起的高度塌陷问题