使用CSS3用图像中的另一种颜色替换颜色

时间:2016-03-04 05:09:01

标签: image css3 replace colors

你可以在CSS3中用另一种颜色替换一种颜色吗?

enter image description here enter image description here

1 个答案:

答案 0 :(得分:3)

通过一些小技巧,你可以轻松地做到这一点。只需转动图像内部,透明然后

enter image description here

<style type="text/css">
.bx{
  width: 73px;
  height: 73px;
  background: transparent url("top.png") no-repeat;
}
.bx.yellow{background-color: yellow}
.bx.green{background-color: green}
</style>

<div class="bx"></div>
<div class="bx yellow"></div>
<div class="bx green"></div>

最后 enter image description here