From our sponsor: Ready to show your plugin skills? Enter the Penpot Plugins Contest (Nov 15-Dec 15) to win cash prizes!
Today we want to share some simple icon hover effects with you. The idea is to create a subtle and stylish effect using CSS transitions and animations on the anchors and their pseudo-elements. For the icons we are using an icon font (Eco Ico by Matthew Skiles, created with the IcoMoon app) which we add using the :before pseudo-class.
The markup only uses an anchor for the icon and we wrap a set into a container so that we can create a variety of effects:
<div class="hi-icon-wrap hi-icon-effect-1 hi-icon-effect-1a"> <a href="#" class="hi-icon hi-icon-mobile">Mobile</a> <a href="#" class="hi-icon hi-icon-screen">Desktop</a> <a href="#" class="hi-icon hi-icon-earth">Partners</a> <a href="#" class="hi-icon hi-icon-support">Support</a> <a href="#" class="hi-icon hi-icon-locked">Security</a> </div>
An example for a hover effect is the simple rotation of the pseudo-element for the icon:
.hi-icon-effect-6 .hi-icon { box-shadow: 0 0 0 4px rgba(255,255,255,1); transition: background 0.2s, color 0.2s; } .no-touch .hi-icon-effect-6 .hi-icon:hover { background: rgba(255,255,255,1); color: #64bb5d; } .no-touch .hi-icon-effect-6 .hi-icon:hover:before { animation: spinAround 2s linear infinite; } @keyframes spinAround { from { transform: rotate(0deg) } to { transform: rotate(360deg); } }
Note that a dashed border on a round pseudo-element (border-radius: 50%) does not work in FF 21.0 (effect 4)
I hope you enjoy the effects and find them inspiring!
Love this! I’m new to the @font-face approach. Can someone explain how you can identify the unicode character references that relate to the different icons? (i.e
content: "\e001";'
) Probably a dumb question I know!Hi Mary Lou,
Got a quick question. You have the icons to be set in the .hi-icon-mobile:before . Is there any way to change the icons that you have in there?
This is so great, I had to share. A few asked if this could be done with Font Awesome. The answer is YES!!! Open the component css file and delete or comment out the @font-family declaration and associated links. Also comment out the classes for the icon set because you won’t be using them (e.g. .hi-icon-mobile:before).
From there everything is icon-agnostic css. Load up your Font-Awesome however you like and replace the hi-icon icon classes with the Font Awesome icon classes in the anchor tag classes from the examples (e.g. icon-twitter). That’s worked for me and I couldn’t be happier.
I was wrong. Not working with Font Awesome. Can’t tell if I am supposed to need the js files or the default css. I’m sure others have the same questions.
Very simple for a big effect. thanks
ssssssss
I can’t get this to work… The font isn’t connecting properly, so I’m getting empty boxes instead of icons.
Nice & Cool Work…
Does this work using a different icon font? I have a custom icon font that I am using but it’s not working with the tutorial. I get empty boxes as well. Is this: content:”\e001″; the code for the icon image?
i could fix the icon “problem” (content: “\e001”), if anyone wants the explanation about fixing it, e-mail me.
Why would you just not post the solution here, seriously??
You are an absolute saint! this is wicked.. Thank you so much for this.
I’m implementing it on my site now with my own icon / font set.. ace..
Ill post the results
10 outa 10 my good lady 🙂
Beautiful, clean and so simple, great work !
Thanks again.. here’s my site using the technique:
http://designnut.co.uk/
You did really nice job …i want to know how you loaded your own font-family :Arty and how to do that? Please let me know
Fantastic demo but… How can I personalize the icon on the button with ones created by myself?!?!?!?!?!?!
amazing, i like and hover effect is very nice
Very nice!
What code would I use to implement a few of these on my website?
oh! you guys are the best amazing hover effect clean and so simple, great work !
Simple is always the best.
Hi. I’m new to web designing. Downloaded the zip file and i got almost how it works. But i couldn’t get how the icons are loaded and the few lines of css codes in component.css. Somebody please help me.
Codes are the one’s that look like this.
.hi-icon-mail:before {
content: “\e00d”;
}
I was not able to figure that out.
I didn’t understand what this class is doing 🙁
class=”hi-icon-wrap hi-icon-effect-1 hi-icon-effect-1a”
.hi-icon-effect-6 .hi-icon
Mary Lou I would like to set the hover event to an outer container. So that when you hover over the text and headings in the container the icon effect is activated.
Worked it out
Replace
.hi-icon:hover:after {
with
.outer-container:hover .hi-icon:after {
Love these effects!
Hi, I love these effects and your tutorials in general. Thanks a lot for taking the time to make them. I’m going to try and combine effects #3 and #4 🙂 Shame about FF
These are really cool but not working in Safari, I don’t know why…
hello im just a beginner in web designing and i was wondering.. how can i replace the icons into an image i made on my own?
because i made some custom icons for my project website.. if its not much of a trouble, please help me with it 🙂
would someone kindly tell me how to change the icons, thanks!
I see a lot of people asking how they can create their own icons. If you are not familiar with the benefits of font icons I implore you to do a little research on google because they rock! There is an amazing online tool called Fontastic where you can upload your own svg files (scalable vector graphics) and spit out a custom font to display on your site. It’s incredibly easy to use and provides you the code to implement your font which looks nearly identical to the format Mary Lou uses here. This should make it easier for you all to incorporate it into this example especially if you are a newbie to custom fonts to begin with. Hope this puts you all in the right direction, enjoy!
Animation 8 is not working in IE9 browser and Safari browser.
URL: – http://tympanus.net/codrops/2013/05/30/simple-icon-hover-effects/
If you get any solution please let me know its very urgent for me Thanks in advance 🙂
Some very useful and awesome effects..Can i use them with the font-awesome icons..Can you please tell how this can be achieved.
Thanks.
Very nice, thanks
this is awesome tutorial. I want to use font awesome can anyone tell me how can i do it
hi Mary, I hope this comment is reaching you. I would like to combine this icon efefct with the dots on your other script “Fullscreen Slit Slider” (the one with animals icons). In that script, I would like to substitute the dots with the animal icons, and have the hover effect indicated on this script. Can you plkease help?
Hi Mary
thank you very much for your tutorials. Always so impressive !!
Do you think that your effects would be available with fontawesome icons ? and if yes, how-to do it ? I am stuck on it.
Thanks again.
Olivier
Odd, I can’t get any of the effects working except set 8 in latest Chrome on Windows.
The effects don’t work in Firefox 29.0a1 (2014-01-19). I also don’t see the navigation buttons at the top (1 2 3 … 9).
Hi
I was wondering, is it possible to use your own icons and create these effects, or can you only use the icons provided by the font?
It looks like, somehow this demo is now broken?
Why not?
a {width: 100px; height: 100px; display: block; background: #ccc; border-radius: 50%; transition: all 0.2s linear;} a:hover {background: #000; transition: all 0.2s linear; box-shadow: 0 0 0 5px #fff, 0 0 0 10px #000;}
<a href="/"></a>
Hi Lashchevsky, yes that effect works but for some reason when I view the demo in the current versions of Firefox, Chrome and Opera very few of the effects on the demo work, almost none.
Great Tips and tricks. Thanks for the awesome effective buttons idea 😉
The spin around effect can be done without keyframe animations by simply using transformation and transformation-ease property:
img.myicon{ vertical-align: middle; } a:hover img.myicon{ transform:rotate(36000deg); -webkit-transform:rotate(36000deg); transition: all 15s ease; -webkit-transition: all 015s ease; -moz-transition: all 15s ease; -o-transition: all 15s ease; background:#ff6600; border-radius:15px; }
My previous comment would give a very fast spinning icon for a longer period of time but for general use the code would look something like:
a:hover img.myicon{ transition: all 30s ease; transform:rotate(2000deg); -webkit-transform:rotate(2000deg); }
Though it will be not infinite, the ease in / ease out effect doesn’t look bad either and also the code is very simple to remember.
I don’t know if we can use simple transformation for a certain element for a given duration without using the ease property.
Really nice icons, great work Mary!!!
awesome!!!!!!!!!!!!!!
I’ll implement some in my themes
many thanks!
thank you very much,this is what i need And i want to how to make it
This menu’s don’t work on Ipad. How can I fixed this for Ipad?
Ok, I have a sollution: change to
Ok, I have a sollution: change the body-tag to – body ontouchstart=” “-
belo post parabens
My queen you rock as always.
Why does the a:link’s in the nav show on only one of my computers? The one that doesnt show them has a bigger screen, but i can figure out why it only shows on the smaller screen. Anyone know?
Thank you always for share your wisdom.
somebody can help me to using this .?