簡體   English   中英

如何更改iconmoon圖標的圖標顏色

[英]How to change Icon colour for iconmoon icons

我已經從icomoom下載了一些圖標,但是圖標的背景顏色是黑色和白色。我想使用自己的顏色。請問任何人可以告訴我該怎么做嗎?

下載圖標后,得到以下style.css

@font-face {
    font-family: 'icomoon';
    src:url('fonts/icomoon.eot?-haa506');
    src:url('fonts/icomoon.eot?#iefix-haa506') format('embedded-opentype'),
        url('fonts/icomoon.woff?-haa506') format('woff'),
        url('fonts/icomoon.ttf?-haa506') format('truetype'),
        url('fonts/icomoon.svg?-haa506#icomoon') format('svg');
    font-weight: normal;
    font-style: normal;
}

[class^="icon-"], [class*=" icon-"] {
    font-family: 'icomoon';
    speak: none;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;

    /* Better Font Rendering =========== */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.icon-home:before {
    content: "\e600";
}
.icon-images:before {
    content: "\e601";
}
.icon-pawn:before {
    content: "\e602";
}

圖標應視為文本。

如果您對它們應用顏色。 他們會改變顏色。

例:

.icon-pawn { color: red; }

我必須使用:: after偽元素。

.icon-pawn::after { color: red; }

我不確定這是否是我的項目所特有的,因為我正在對其他人的代碼進行小的更改。

這對我有用:

.icon-color-success:before {
    color: #28a745 !important;
}

接着:

<i class="icon-python icon-color-success"></i>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM