【问题标题】:How can i change the icon color to some other color in CSS?如何在 CSS 中将图标颜色更改为其他颜色?
【发布时间】:2017-01-06 07:41:08
【问题描述】:

我想通过 CSS 改变这个图标颜色:

【问题讨论】:

  • 如果这是一个svg图标,你可以使用colorpropert来改变svg图标的颜色。
  • 请更新您的问题以包含相关代码并在此处提出您的问题,而不是通过链接提出问题
  • 我没试过,我只是问问。
  • 你能举个例子吗?
  • 请通过How to Ask StackOverflow 上的问题。

标签: html css


【解决方案1】:

这个怎么样?来自this site

<!DOCTYPE html>
<html>
<head>
<style>
img {
    width: 33%;
    height: auto;
    float: left;
    max-width: 235px;
    background-color: #12569a;
}


.blur {-webkit-filter: blur(4px);filter: blur(4px);}
.brightness {-webkit-filter: brightness(250%);filter: brightness(250%);}
.contrast {-webkit-filter: contrast(180%);filter: contrast(180%);}
.grayscale {-webkit-filter: grayscale(100%);filter: grayscale(100%);}
.huerotate {-webkit-filter: hue-rotate(180deg);filter: hue-rotate(180deg);}
.invert {-webkit-filter: invert(100%);filter: invert(100%);}
.opacity {-webkit-filter: opacity(50%);filter: opacity(50%);}
.saturate {-webkit-filter: saturate(7); filter: saturate(7);}
.sepia {-webkit-filter: sepia(100%);filter: sepia(100%);}
.shadow {-webkit-filter: drop-shadow(8px 8px 10px green);filter: drop-shadow(8px 8px 10px green);}
</style>
</head>
<body>

<p><strong>Note:</strong> The filter property is not supported in Internet Explorer, Edge 12, or Safari 5.1 and earlier.</p>

<img src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="blur a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="brightness a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="contrast a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="grayscale a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="huerotate a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="invert a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="opacity a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="saturate a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="sepia a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">
<img class="shadow a" src="http://i.stack.imgur.com/W8L0k.png" alt="Pineapple" width="300" height="300">

</body

>

【讨论】:

    猜你喜欢
    • 2023-01-26
    • 2021-11-24
    • 1970-01-01
    • 2012-06-01
    • 2014-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多