I'm trying to use a custom icon inside of a bootstrap button, this is the html part:
<button class="btn btn-info pull-right toggle" data-pausetext="Break In"
data-resumetext="Resume" ><i class="icon-play"></i> Clock In</button>
and on the stylesheet have this:
.icon-play {
background-image : url(../img/Clock-Play.png) no-repeat;
background-position: center center;
}
but the icon is not showing inside the button...please help...thanks
It is as simple as applying Font Awesome icon on any button. The <i> tag and <span> tag are used widely to add icons on the webpages. To add any icons on the web pages, it needs the font-awesome link inside the head section. The font-awesome icon can be placed by using the fa prefix before the icon's name.
First of all your <i>
element doesn't have a height and width property.
But adding height and width alone wouldn't do what you want because <i>
is an inline element so you want to add another property as well i-e. display: inline-block
Then the last thing to make it perfect would be to add background-size: cover
(to adjust icon exactly into its container element)
.icon-play{
background-image : url(../img/Clock-Play.png);
background-size: cover;
display: inline-block;
height: 15px;
width: 15px;
}
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