Here's the fiddle: http://jsfiddle.net/sarvagnya1/BLAXF/
I need to center a glyphicon inside a div both vertically and horizontally.
Here's the code: HTML:
<div class="container">
<div class="item">
<span class="glyphicon glyphicon-text-width"></span>
</div>
CSS:
.container{
width: 600px;
margin: 0 auto;
border: 1px solid #000;
}
.item{
width: 150px;
height: 150px;
border: 1px solid #ddd;
}
.item span{
font-size: large;
}
Drag the vertical line next to the icons to move the icons to an ideal center position on your taskbar. Once icons are centered, right-click on the taskbar and select Lock the taskbar from the pop-up menu.
The most preferred way to center Font Awesome Icons is to assign a center class to each <i> tag. Setting width to 100%, let's each icon cover 100% area horizontally. Also text-align then centers the icon accordingly to the width being used. Example 1: Adding a custom class in all <i> tag.
You need the add this:
.item{
...
text-align: center;
}
.item span{
...
line-height: 150px;
}
http://jsfiddle.net/BLAXF/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With