为IE8模拟RGBA

时间:2015-07-09 10:29:53

标签: css internet-explorer internet-explorer-8

我想效仿: IE8的后台:rgba(0, 0, 0, 0.25);和后台:rgba(0, 0, 0, 0.45); 我成功地解决了这个问题:

-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4C000000, endColorstr=#4C000000)";

可以用于rgba(0, 0, 0, 0.4);

我如何才能拥有0.25和0.45的正确Colorstr?

1 个答案:

答案 0 :(得分:1)

calculate ARGB for RGBA



body{
    background: #FFF8DC;
}

div{
    width: 200px;
    height: 100px;
    margin: 10px auto;
    
}
.div1{
    background: rgba(0, 0, 0, 0.25);
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3F000000, endColorstr=#3F000000)";
}
.div2{
    background: rgba(0, 0, 0, 0.45);
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#72000000, endColorstr=#72000000)";
}

<div class="div1"></div>
<div class="div2"></div>
&#13;
&#13;
&#13;