Using CSS to give a black icon another color

后端 未结 2 1692
甜味超标
甜味超标 2021-02-13 05:22

I saw some apps where even though a black icon was included, some how the app used CSS to convert the icon into a different colour. I can\'t seem to repeat this process

2条回答
  •  -上瘾入骨i
    2021-02-13 06:07

    Your code isn't working because the src attribute is being used to show up the black version on top of the orange version. You will be able to get the desired result only with CSS, this way:

    .dashboard-buttons .sessions .img { width: 60px; height: 60px; background-color: #C60; }
    .dashboard-buttons .sessions .img { -webkit-mask-image: url('http://i.stack.imgur.com/gZvK4.png'); }
    

    Here is the changed HTML snippet:

    And here is a working sample of it.

提交回复
热议问题