Is it possible to color the fontawesome icon colors?

前端 未结 7 1931
甜味超标
甜味超标 2021-01-30 05:27

I can change fontcolor, but not the \"fill\". I first tried setting background-color, but that fills the whole icon box area.

For example, I have



        
7条回答
  •  长情又很酷
    2021-01-30 05:55

    The problem with "-webkit-text-stroke" is that is not fully supported by FF and IE, so what I do in this case is to use the half star in a pseudo class inside of the normal star, something like this:

    .icon-star.red-border {
        position: relative;
        color: blue;
        font-size: 24px;
    }
    
    .icon-star.red-border:after {
        content: "\f006";
        color: red;
        position: absolute;
        left: 0;    
    }
    

    And works for me, here is the fiddle

    Thanks.

提交回复
热议问题