cwd cwd - 1 month ago 10
CSS Question

Can I add color to bootstrap icons only using CSS?

Twitter's bootstrap uses Icons by Glyphicons. They are "

available in dark gray and white
" by default:


Is it possible to use some CSS trickery to change the colors of the icons? I was hoping for some other css3 brilliance that would prevent having to have an icon image set for each color.

I know you can change the background color of the enclosing (
) element, but I'm talking about the icon foreground color. I guess it would be possible to inverse the transparency on the icon image and then set the background color.

So, can I add color to bootstrap icons only using CSS?


Yes, if you use font awesome with bootstrap! The icons are slightly different, but there are more of them, they look great at any size, and you can change the colors of them.

Basically the icons are fonts and you can change the color of them just with the css color property. Integration instructions are at the bottom of the page in the provided link.

Edit: Bootstrap 3.0.0 icons are now fonts!

As some other people have also mentioned with the release of bootstrap 3.0.0, the default icon glyphs are now fonts like Font Awesome, and the color can be changed simply by changing the color css property. Changing the size can be done via font-size property.