I hope this question was not already asked somewhere in this forum. I swear I searched it!
My goal is to change the "tag" icon when mouse is over it. Namely, I would like to let the "tags" icon appear replacing the old one.
I am quite sure there is an easy solution out there; probably using
.fa-tag:hover {
background: url(something);
}
Here the page of my website with the .fa-tag icons : http://wordsinthebucket.com/about
Thank you in advance for your attention.
Open the http://fontawesome.io/icons/ link and choose any icon you like. Just click on the needed icon, copy its class and paste to Caption field. For example, fa-user-circle-o. Save the changes and enjoy your new icon on the website!
This task can be simply done by using the CSS background-image property in combination with the :hover pseudo-class to replace or change the image on mouseover. Example: HTML.
Change fa-weight icon size To increase fa-weight font awesome icon size, use the fa-lg (33% increase), fa-2x, fa-3x, fa-4x, or fa-5x classes along with icon class fa-weight. Increase in icon size will be relative to their parent container.
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.
I would have two icons but have only one visible at a time, toggling them based on :hover
state. I feel this is more flexible then messing with background
.
.change-icon > .fa + .fa,
.change-icon:hover > .fa {
display: none;
}
.change-icon:hover > .fa + .fa {
display: inherit;
}
<link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.css" rel="stylesheet" />
<span class="change-icon">
Tags
<i class="fa fa-tags"></i>
<i class="fa fa-gear"></i>
</span>
.fa-camera-retro:hover:before{
content: "\f02d";
}
demo - http://www.bootply.com/oj2Io7btD7
you will need to change the content
of :before
pseudo element on hover
here is the list of complete fontawesome content codes
http://astronautweb.co/snippet/font-awesome/
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