Change the color of glyphicons to blue in some- but not at all places using Bootstrap 2

后端 未结 12 1175
萌比男神i
萌比男神i 2020-11-30 20:38

I am using the Bootstrap framework for my UI. I want to change the color of my glyphicons to blue, but not in all places. In some places it should use the default color.

相关标签:
12条回答
  • 2020-11-30 21:04

    You can do this as well, hopeit helps

    <span style="color:black"><i class="glyphicon glyphicon-music"></i></span>
    
    0 讨论(0)
  • 2020-11-30 21:04

    CSS:

    .blue-icon{
    color:blue !important;
    }
    

    HTML

    <i class="fa fa-wrench blue-icon"></i>
    

    Glyphicons are removed in 4.0, i recommend Font-awesome 4 or newer :)

    0 讨论(0)
  • 2020-11-30 21:07

    I created an alternate colors library for bootstrap 2.3.2 it's available and simple to use for anyone interested in more colors for the old glyphicons library.

    0 讨论(0)
  • 2020-11-30 21:08

    Simply apply Twitter Bootstrap text-success class on Glyphicon:

    <span class="glyphicon glyphicon-play text-success">начал работу</span>
    

    enter image description here

    Full list of available colors: Bootstrap Documentation: Helper classes
    (Blue is present also)

    0 讨论(0)
  • 2020-11-30 21:10

    Finally I found answer myself. To add new icons in 2.3.2 bootstrap we have to add Font Awsome css in you file. After doing this we can override the styles with css to change the color and size.

    <link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
    

    CSS

    .brown{color:#9b846b}
    

    If we want change the color of icon then just add brown class and icon will turn in brown color. It also provide icon of various size.

    HTML

    <p><i class="icon-camera-retro icon-large brown"></i> icon-camera-retro</p> <!--brown class added-->
    <p><i class="icon-camera-retro icon-2x"></i> icon-camera-retro</p>
    <p><i class="icon-camera-retro icon-3x"></i> icon-camera-retro</p>
    <p><i class="icon-camera-retro icon-4x"></i> icon-camera-retro</p>
    
    0 讨论(0)
  • 2020-11-30 21:11

    If it is only a bootstrap icon. Note that icons are under text or rather typography. Just add the text color class like this. E.g text-primary, text-info and so on and so forth to the icon class:

    <i class="icon features-icon icons8-collaboration-2 text-primary"></i>
    <i class="icon features-icon icons8-collaboration-2 text-secondary"></i>
    
    0 讨论(0)
提交回复
热议问题