html - 白色 icon.png 到蓝色 icon.png (html/css)

标签 html css

白色 icon.png 到蓝色 icon.png (html/css)

之前是白色icon.png。之后它也有白色。如何制作,例如,蓝色 icon.png?

HTML:

<img src="icon.png" class="icon1">

CSS:

icon1 {
 background: url(icon.png);
 color: blue;
}
//not working

或者这个

html:

<img src="icon.png" class="icon2">

CSS:

icon2 {
 color: blue;
}
//also not working

你能告诉我怎么做吗?不是 photoshop,只有 html 和 css。

最佳答案

可能与 mask-image

如你所见

div {
  width: 600px;
  height: 600px;
  background-color: blue; /* select your want color */
  -webkit-mask-image: url(https://image.flaticon.com/icons/png/512/54/54591.png);
  mask-image: url(https://image.flaticon.com/icons/png/512/54/54591.png);
  mask-repeat:no-repeat;
  -webkit-mask-repeat:no-repeat;
}
<div></div>

关于html - 白色 icon.png 到蓝色 icon.png (html/css),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53977081/

相关文章:

html - 如何在 outlook 2010 html 邮件中显示背景颜色?

html - 高级菜单项的问题

html - CSS 未正确更新

javascript - 在 Rails 中播放上传的音乐

html - 如何以两种方式切割 div 以保持对象居中?

css - 为什么Fontin字体在浏览器上很锐利,但在PDF阅读器上却很流畅?

javascript - 如何使用链接到已打开页面的 href

css - 导航栏折叠不覆盖正文内容

html - 我正在尝试创建如下图所示的网格

html - 如何在 Bootstrap 导航栏中动态设置事件类?