互联网浏览器-IE8线性梯度,边界半径和不透明度



我有一个div,它有线性梯度、边界半径和不透明度。这是工作在ie9+,ff,铬等

但在IE8中,我遇到了一个问题(使用css3pie):
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#40000000", endColorstr="#40FFFFFF",GradientType=1 );
这将得到我的梯度和不透明度,但忽略我的border-radius: 0 0 100% 0;

当我使用饼图背景时:
-pie-background: linear-gradient(right, #cce6f5 21%, '.$block_color.' 110%);
我的线性渐变有效,边界半径有效,但我无法使不透明度发挥作用。我试过:

opacity:0.4 // not supported in IE8
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
filter: alpha(opacity=40);

以上都不起作用。

如何在IE8中让它们三个都在同一个div上工作?

编辑块的完整css:

width: 204px;
height: 87px;
margin-top: 20px;
opacity: 0.4;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
-o-border-bottom-right-radius: 100%; /* Opera */
-webkit-border-bottom-right-radius: 100%;
-moz-border-radius-bottomright: 100%;
border-radius:0 0 100% 0;
position:relative;
z-index:1;
background-image: linear-gradient(right, #cce6f5 21%, '.$block_color.' 110%);
background-image: -o-linear-gradient(right , #cce6f5 21%, '.$block_color.' 110%);
background-image: -moz-linear-gradient(right , #cce6f5 21%, '.$block_color.' 110%);
background-image: -webkit-linear-gradient(right , #cce6f5 21%, '.$block_color.' 110%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#40'.$ms_block_color.'",endColorstr="#40CCE6F5",GradientType=1 );
zoom:1;
background-image: -webkit-gradient(
  linear,
  right ,
  left ,
  color-stop(0.21, #cce6f5),
  color-stop(0.80, '.$block_color.')
);
behavior: url(/includes/PIE.htc);

如果您与IE8发生冲突,请尝试以下示例:

.div {
background:rgb(0,0,0);
background:rgba(0,0,0,0.4);
-pie-background:rgba(0,0,0,0.4);
}

此外:1.设置具有alpha通道透明度的背景:第一个为IE无PIE,第二个为IE PIE,其他为第三个2.IE8的使用行为3.防止IE9使用PIE示例:

:root *> .div {
  behavior: none;
}

请记住,后台有三个声明。第一个是回退,如果PIE不起作用(即Javascript关闭),它将显示实心背景色。第二个是PIE的声明,除了使用PIE的IE之外,所有浏览器都会忽略它。第三种设置具有alpha透明度的背景。不支持这一点的浏览器将忽略它并使用前面的声明。

我希望这将帮助u:)

最新更新