Internet Explorer和mozilla rgba css3问题

web*_*ers 0 css css3 rgba

我有这种CSS风格:

    background:#000;
    background:rgba(0,0,0,0.7);
    background: transparent;
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#B2000000,endColorstr=#B2000000)"; /* IE8 */    
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#B2000000,endColorstr=#B2000000);   /* IE6 & 7 */      
    zoom: 1;
Run Code Online (Sandbox Code Playgroud)

它在Internet Explorer中运行良好,但我必须保持背景:透明; 样式.如果我保留它,mozilla使我的背景透明

任何想法?

Jar*_*ish 5

学习使用IE Con​​ditionals处理IE怪癖:

http://www.quirksmode.org/css/condcom.html

<style type="text/css">
.stuff {
  background:#000;
  background:rgba(0,0,0,0.7);
}
</style>

<!--[if IE]>
<style type="text/css">
.stuff {
  background: transparent;
  -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#B2000000,endColorstr=#B2000000)"; /* IE8 */    
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#B2000000,endColorstr=#B2000000);   /* IE6 & 7 */
  zoom: 1;
}
</style>
<![endif]-->

<div class="stuff">Stuff</div>
Run Code Online (Sandbox Code Playgroud)

jsfiddle demo:http://jsfiddle.net/cYtKJ/1/

编辑

您还可以使用它来导入不同的样式文件:

<link rel="stylesheet" type="text/css" href="style.css">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="style-ie.css">
<![endif]-->
Run Code Online (Sandbox Code Playgroud)

如果它覆盖了其他css命令,你必须小心将style-ie.css放在最后.