Change color of PNG image via CSS?

后端 未结 16 1388
自闭症患者
自闭症患者 2020-11-22 07:33

Given a transparent PNG displaying a simple shape in white, is it possible to somehow change the color of this through CSS? Some kind of overlay or what not?

16条回答
  •  孤街浪徒
    2020-11-22 07:52

    You might want to take a look at Icon fonts. http://css-tricks.com/examples/IconFont/

    EDIT: I'm using Font-Awesome on my latest project. You can even bootstrap it. Simply put this in your :

    
    
    
    
    

    And then go ahead and add some icon-links like this:

    
    

    Here's the full cheat sheet

    --edit--

    Font-Awesome uses different class names in the new version, probably because this makes the CSS files drastically smaller, and to avoid ambiguous css classes. So now you should use:

    
    

    EDIT 2:

    Just found out github also uses its own icon font: Octicons It's free to download. They also have some tips on how to create your very own icon fonts.

提交回复
热议问题