css 透明度 一句话搞定透明背景!
2012-11-03 13:45
323 查看
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 .
.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 .
相关文章推荐
- CSS实现背景透明,Opacity定义了有背景的盒子透明度,但里面的文字也跟着透明
- CSS实现背景透明,文字不透明(各浏览器兼容)
- CSS实现背景透明,文字不透明(兼容各浏览器)
- css 背景透明 适合所有浏览器
- CSS让div背景透明
- CSS实现背景透明,文字不透明(各浏览器兼容) (转)
- CSS实现背景透明,文字不透明(各浏览器兼容)
- 兼容IE6和Firefox的PNG背景透明CSS…
- css 背景透明解决方案
- CSS实现背景透明而背景上的文字不透明
- CSS透明opacity和IE各版本透明度滤镜filter的最准确用法
- css透明opacity和浏览器透明度滤镜filter的用法
- css实现背景透明文字不透明
- CSS半透明背景 文字不透明
- 用css实现表格背景透明,内容不透明
- css 背景透明 文字不透明
- CSS实现背景透明文字不透明兼容各种浏览器有图有真相
- CSS实现背景透明,文字不透明(各浏览器兼容)
- CSS实现背景透明完美解决方案
- css两种让div背景透明文案不透明的方式(opacity、rgba)