
Icons Hover Animations
Before We Start to Icons Hover Animations
Icons Hover Animations can be used to animate a Icons, Buttons, etc. and create user attractive UI components.
So if you are a person who wishes to develop a website, you have to know how to create animations properly. Check out our tutorial and you can learn this techniques and use it on your web development. Below sections shows how to develop this animations.
How to create? We are here to solve your problem. In this article we discuss how to create a hover effect animations. Before we start please read the below articles which easier you to understand the process, if you are new to development.
Step 1 – Add HTML
It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag as below.
<div class="row py-5">
<div class="col-md-5"></div>
<div class="col-md-2 text-center">
<h5 style="margin-top:20px;">With default border</h5>
<div class="icon-container" data-icon="circle blue border">
<i class="fa fa-envelope"></i>
<svg>
<path class="icon-circle" d="m1.5,25c0,-13 10.5,-23.5 23.5,-23.5c13,0 23.5,10.5 23.5,23.5c0,13 -10.5,23.5 -23.5,23.5c-13,0 -23.5,-10.5 -23.5,-23.5z" />
<path class="icon-square" d="m1.5,1.5l47.0453,0l0,47-47,0l0,-47z">
</svg>
</div>
<div class="icon-container" data-icon="square red border">
<i class="fa fa-bell"></i>
<svg>
<path class="icon-circle" d="m1.5,25c0,-13 10.5,-23.5 23.5,-23.5c13,0 23.5,10.5 23.5,23.5c0,13 -10.5,23.5 -23.5,23.5c-13,0 -23.5,-10.5 -23.5,-23.5z" />
<path class="icon-square" d="m1.5,1.5l47.0453,0l0,47-47,0l0,-47z">
</svg>
</div>
</div>
<div class="col-md-5"></div>
</div>
<div class="row py-5">
<div class="col-md-5"></div>
<div class="col-md-2 text-center">
<h5 style="margin-top:20px;">Circles, no default border</h5>
<div class="icon-container" data-icon="circle green">
<i class="fa fa-binoculars"></i>
<svg>
<path class="icon-circle" d="m1.5,25c0,-13 10.5,-23.5 23.5,-23.5c13,0 23.5,10.5 23.5,23.5c0,13 -10.5,23.5 -23.5,23.5c-13,0 -23.5,-10.5 -23.5,-23.5z" />
<path class="icon-square" d="m1.5,1.5l47.0453,0l0,47-47,0l0,-47z">
</svg>
</div>
<div class="icon-container" data-icon="circle red">
<i class="fa fa-times"></i>
<svg>
<path class="icon-circle" d="m1.5,25c0,-13 10.5,-23.5 23.5,-23.5c13,0 23.5,10.5 23.5,23.5c0,13 -10.5,23.5 -23.5,23.5c-13,0 -23.5,-10.5 -23.5,-23.5z" />
<path class="icon-square" d="m1.5,1.5l47.0453,0l0,47-47,0l0,-47z">
</svg>
</div>
<div class="icon-container" data-icon="circle blue">
<i class="fa fa-exclamation"></i>
<svg>
<path class="icon-circle" d="m1.5,25c0,-13 10.5,-23.5 23.5,-23.5c13,0 23.5,10.5 23.5,23.5c0,13 -10.5,23.5 -23.5,23.5c-13,0 -23.5,-10.5 -23.5,-23.5z" />
<path class="icon-square" d="m1.5,1.5l47.0453,0l0,47-47,0l0,-47z">
</svg>
</div>
</div>
<div class="col-md-5"></div>
</div>
<div class="row py-5">
<div class="col-md-5"></div>
<div class="col-md-2 text-center">
<h5 style="margin-top:20px;">Squares, no default border</h5>
<div class="icon-container" data-icon="square yellow">
<i class="fa fa-binoculars"></i>
<svg>
<path class="icon-circle" d="m1.5,25c0,-13 10.5,-23.5 23.5,-23.5c13,0 23.5,10.5 23.5,23.5c0,13 -10.5,23.5 -23.5,23.5c-13,0 -23.5,-10.5 -23.5,-23.5z" />
<path class="icon-square" d="m1.5,1.5l47.0453,0l0,47-47,0l0,-47z">
</svg>
</div>
<div class="icon-container" data-icon="square red">
<i class="fa fa-times"></i>
<svg>
<path class="icon-circle" d="m1.5,25c0,-13 10.5,-23.5 23.5,-23.5c13,0 23.5,10.5 23.5,23.5c0,13 -10.5,23.5 -23.5,23.5c-13,0 -23.5,-10.5 -23.5,-23.5z" />
<path class="icon-square" d="m1.5,1.5l47.0453,0l0,47-47,0l0,-47z">
</svg>
</div>
<div class="icon-container" data-icon="square blue">
<i class="fa fa-exclamation"></i>
<svg>
<path class="icon-circle" d="m1.5,25c0,-13 10.5,-23.5 23.5,-23.5c13,0 23.5,10.5 23.5,23.5c0,13 -10.5,23.5 -23.5,23.5c-13,0 -23.5,-10.5 -23.5,-23.5z" />
<path class="icon-square" d="m1.5,1.5l47.0453,0l0,47-47,0l0,-47z">
</svg>
</div>
</div>
<div class="col-md-5"></div>
</div>
Step 2 – Add CSS
We use some external CSS link to this code. No need to worry about this, copy and paste below code in between <head></head> tag.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" crossorigin="anonymous"/>
Copy and paste below code in your HTML editor between <style></style> tag as below.
<style>
.icon-container {
border: 3px solid transparent;
background-color: transparent;
position: relative;
display: inline-block;
color: #716666;
width: 50px;
height: 50px;
transition: color 0.8s ease-in-out;
cursor: pointer;
}
.icon-container i {
border: 3px solid transparent;
margin: 28% auto;
font-size: 16px;
text-align: center;
width: 44px;
}
.icon-container svg {
position: absolute;
top: -3px;
left: 50%;
width: 50px;
height: 50px;
transform: translateX(-50%);
pointer-events: none;
}
.icon-container svg path {
fill: none;
stroke: #716666;
stroke-width: 3;
stroke-dasharray: 200;
stroke-dashoffset: 200;
stroke-linecap: square;
transition: stroke-dashoffset 0.8s ease-in-out;
}
.icon-container:hover svg path {
stroke-dashoffset: 0;
}
.icon-container[data-icon~="border"] {
border-color: #716666;
}
.icon-container[data-icon~="square"] svg path.icon-circle {
display: none;
}
.icon-container[data-icon~="square"] svg path.icon-square {
display: block;
}
.icon-container[data-icon~="circle"] {
border-radius: 25px;
}
.icon-container[data-icon~="circle"] svg path.icon-circle {
display: block;
}
.icon-container[data-icon~="circle"] svg path.icon-square {
display: none;
}
.icon-container[data-icon~="red"] svg path {
stroke: #FF4136;
}
.icon-container[data-icon~="red"]:hover {
color: #FF4136;
}
.icon-container[data-icon~="yellow"] svg path {
stroke: #FFDC00;
}
.icon-container[data-icon~="yellow"]:hover {
color: #FFDC00;
}
.icon-container[data-icon~="blue"] svg path {
stroke: #0074D9;
}
.icon-container[data-icon~="blue"]:hover {
color: #0074D9;
}
.icon-container[data-icon~="green"] svg path {
stroke: #4CC259;
}
.icon-container[data-icon~="green"]:hover {
color: #4CC259;
}
</style>
At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.
Out Put


Video Tutorial
Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.
Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.