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

2016-04-19css教程
119


复制代码
代码如下:

.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/
 这个我就不想翻译了,很简单,我也只是为了做个记录。哈~~~

The End

相关推荐

简单但很实用的5个css属性
下面是详细讲解“简单但很实用的5个CSS属性”的完整攻略:...
2023-12-15 css教程
34

我的css框架——base.css(重设浏览器默认样式)
第一步:创建项目文件夹...
2023-12-15 css教程
195

JS 控制CSS样式表
JS 控制 CSS 样式表的方式主要有两种:通过修改样式属性来修改元素样式,以及通过切换 CSS 类名来切换元素样式。下面分别给出具体的步骤和示例说明。...
2023-12-15 css教程
25

css中style和class的加载顺序示例介绍
让我们来详细讲解“CSS中style和class的加载顺序示例介绍”的攻略。...
2023-12-15 css教程
124

css 列表菜单的设计
关于“CSS 列表菜单的设计”的完整攻略,我给您提供以下几点建议:...
2023-12-15 css教程
9

样式表CSS布局经验
当我们设计网站时,样式表CSS布局是一个非常重要的部分。它可以使我们的网站看起来更加美观,同时使网站更加易于导航和使用。以下是一些在CSS布局时应该遵循的经验。...
2023-12-15 css教程
59