IE8 - div中的圆角与不透明度

时间:2014-01-23 12:50:12

标签: css3 internet-explorer-8 pie-chart

我使用过滤器在IE8中使div背景透明:

-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";

当我想要圆角时,我发现PIE.htc与css

-webkit-border-radius: 10px; 
-moz-border-radius: 10px; 
border-radius:10px; 
-ms-behavior: url('./../css/PIE.htc');
behavior: url('./../css/PIE.htc');

但是当我尝试组合这段代码时,我得到了带圆角但没有不透明度的元素。这是我元素的完整css代码:

#frontpage .form_wrapper .form_background{
width:100%; 
height: 100%;
position: absolute;
z-index: 1; 
opacity: 0.7; 
background-color: #ffffff; 
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; 
-webkit-border-radius: 10px; 
-moz-border-radius: 10px; 
border-radius:10px; 
-ms-behavior: url('./../css/PIE.htc');
behavior: url('./../css/PIE.htc');}

有可能吗?


UPD

感谢您的回答。 我遇到了一个问题:

-pie-background:rgba(255,255,255,.7);
除了IE之外,

在任何其他浏览器中都无效。所以,我只能将它包含在IE8中。这是我的解决方案,也许它可以帮助某人。 HTML文件:

 <!--[if lte IE 8]><div class="IE IE8andLower form_background rounded_corners"></div><![endif]-->
 <!--[if gt IE 8]><div class="IE IE8higher form_background rounded_corners"></div><![endif]-->
 <!--[if !IE]>--><div class="notIE form_background rounded_corners"></div><!--<![endif]-->

相应的CSS规则:

#frontpage .form_wrapper .form_background{
    width:100%; 
    height: 100%; 
    position: absolute; 
    z-index: 1; 
    opacity: 0.7; 
    -webkit-border-radius: 10px; 
    -moz-border-radius: 10px; 
    border-radius:10px;
 }

#frontpage .form_wrapper .form_background.notIE,#frontpage .form_wrapper .form_background.IE.IE8higher {
    background-color: #ffffff
 }

#frontpage .form_wrapper .form_background.IE.IE8andLower{ 
    -pie-background:rgba(255,255,255,.7); 
    behavior: url('./../css/PIE.htc');
 }

1 个答案:

答案 0 :(得分:1)

您不能使用ms过滤器和不透明度,但可以使用css饼背景属性来实现rgba值:

-pie-background:rgba(255,255,255,.7);

只需删除背景颜色:#fff