Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap - Making CSS Icons bigger

I'm using Twitter Bootstrap and it says to use <i class="icon-flag"></i> if I want to use an icon from their CSS sprite.

How can I add my own css class called .logo-icon which will take one of their icons but make it bigger?

My class currently looks like:

.logo-icon {
    background-image: url("../img/glyphicons-halflings-white.png");
    background-position: -312px -24px;
}
like image 835
Jamesking56 Avatar asked Nov 24 '12 18:11

Jamesking56


People also ask

How do I make bootstrap icons bigger?

Larger icons To increase icon sizes relative to their container, use the fa-lg (33% increase), fa-2x , fa-3x , fa-4x , or fa-5x classes. If your icons are getting chopped off on top and bottom, make sure you have sufficient line-height.

How do I make icons bigger CSS?

Larger Icons To increase the size of icons relative to its container, use icon-large , icon-2x , icon-3x , or icon-4x . Increase the icon size by using the icon-large (33% increase), icon-2x , icon-3x , or icon-4x classes.

How do I make bootstrap icons bolder?

Bootstrap Icon type bold Icon | type bold | HTML, CSS It is pretty simple to change color of icon Type bold just add style="color:red" it will make font color red. On the same way you can change size of Type bold icon by just adding style="font-size:50px;".


2 Answers

best and easiest

is to change font size of the span tag

span.glyphicon {
    font-size: 8px;  
}

or

<span class="glyphicon glyphicon-check" style="font-size: 1.2em"></span>

using FontAwesome?

And if like me you use FontAwesome too, you could go hybrid ;) use these classes

<span class="glyphicon glyphicon-check fa-lg"></span>
<span class="glyphicon glyphicon-check fa-2x"></span>
<span class="glyphicon glyphicon-check fa-3x"></span>
<span class="glyphicon glyphicon-check fa-4x"></span>
like image 91
azerafati Avatar answered Nov 15 '22 21:11

azerafati


What if you use scale()???

.logo-icon {
    transform:scale(2.0,2.0);
    -ms-transform:scale(2.0,2.0); /* IE 9 */
    -moz-transform:scale(2.0,2.0); /* Firefox */
    -webkit-transform:scale(2.0,2.0); /* Safari and Chrome */
    -o-transform:scale(2.0,2.0); /* Opera */
}

Isn't it easier to use and maintain? You can scale to any size you wish without recalculating background-size and position.

I am using this for reducing the size of the icons in some parts of my system. I spent around 1 hour looking for a solution to reduce and almost forgot about scale(). So, just sharing to help others. =D

But, of course, if you make them bigger you will not get a perfect good looking icon.

like image 20
lao Avatar answered Nov 15 '22 22:11

lao