Hello developers, today in this blog, you'll learn how to create Floating Buttons with Hover Animation using HTML & CSS.
A floating action menu is typically a circular button that sticks to the left bottom of the webpage and pops up a floating interface containing menu links, social buttons, or commonly used actions when clicked or tapped.
In this program (Floating Buttons with Hover Animation) on the webpage, there is a vertical bar at the left bottom of the webpage. When you hover on the share icon, a floating menu will arise from bottom to top and there are some share button icons like Linkedin, Instagram, and Facebook. The share button icon will get rotated to 360 degrees by using the @keyframe property.
The source code of this Floating Buttons with Hover Animation is given below, if you want the source code of this program, you can copy it. You can use these Floating Buttons with Hover Animation code on your projects.
Floating Buttons with Hover Animation [Source Code]
To make this website, you would like to make two files: an HTML file & a CSS file. First, create an HTML file with the name of index.html and remember, you have to create a file with a .html extension.
*{padding:0;margin:0;}
body{
font-family:Verdana, Geneva, sans-serif;
background-color: #FBAB7E;
background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%);
font-size:12px;
}
.float{
position:fixed;
width:60px;
height:60px;
bottom:40px;
left:40px;
background-color:#12192c;
color:#FFF;
border-radius:50px;
text-align:center;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
z-index:1000;
animation: bot-to-top 2s ease-out;
}
ul{
position:fixed;
left:40px;
padding-bottom:20px;
bottom:80px;
z-index:100;
}
ul li{
list-style:none;
margin-bottom:10px;
}
ul li a{
background-color:#12192c;
color:#FFF;
border-radius:50px;
text-align:center;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
width:60px;
height:60px;
display:block;
}
ul:hover{
visibility:visible!important;
opacity:1!important;
}
.my-float{
font-size:24px;
margin-top:18px;
}
a#menu-share + ul{
visibility: hidden;
}
a#menu-share:hover + ul{
visibility: visible;
animation: scale-in 0.5s;
}
a#menu-share i{
animation: rotate-in 0.5s;
}
a#menu-share:hover > i{
animation: rotate-out 0.5s;
}
@keyframes bot-to-top {
0% {bottom:-40px}
50% {bottom:40px}
}
@keyframes scale-in {
from {transform: scale(0);opacity: 0;}
to {transform: scale(1);opacity: 1;}
}
@keyframes rotate-in {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}
@keyframes rotate-out {
from {transform: rotate(360deg);}
to {transform: rotate(0deg);}
}
.credit a{
text-decoration: none;
color: #000;
font-weight: 800;
}
.credit {
position: fixed;
bottom:20px;
left:45%;
margin-top: 10px;
}
Thank you for reading our blog. If you face any problem in creating these Floating Buttons with Hover Animation using HTML, CSS & JavaScript, then contact us or comment us. We’ll try to provide a solution to your problem as soon as possible.
Post a Comment
Thank you
Learning robo team