我有一个覆盖在图像上的div,使用filter: grayscale(100%);
填充包含div的50%
,但该过滤器不会应用于我的图像。
然而,如果我将图像放在我的filterBar
div中,它只会使整个图像变成灰度。我需要根据评分数量将图像变成灰色。
这种做法可行吗?
HTML
<div class="rating-wrapper-v2 bp-rating row">
<div class="col-xs-6">
<div class="filterBar"></div>
<img src="https://www.baopals.com/catalog/view/theme/lexus_megashop/image/Baopals-Facebook.png" style="width: 100px;" alt="Baopals Rating" />
</div>
<div class="col-xs-6">
<p>BAOPALS SCORE</p>
<span>2.5</span>
<span>/</span>
<span>5</span>
</div>
</div>
CSS
.rating-wrapper-v2{
width:300px;
}
.filterBar{
filter: grayscale(100%);
position: absolute;
height: 50%;
width:100%;
bottom:0;
z-index:100;
}