Floating Buttons with Hover Animation using HTML & CSS

Floating Buttons with Hover Animation using HTML & CSS

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.

<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>floating share button menu|| Learningrobo</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> <link rel="stylesheet" href="style.css"> </head> <body> <a href="#" class="float" id="menu-share"> <i class="fa fa-share-alt my-float"></i> </a> <ul> <li><a href="#" id="menu-facebook"> <i class="fa fa-facebook my-float"></i> </a></li> <li><a href="#" id="menu-google-plus"> <i class="fa fa-instagram my-float"></i> </a></li> <li><a href="#" id="menu-twitter"> <i class="fa fa-linkedin my-float"></i> </a></li> </ul> <div class="credit">Made with <span style="color:tomato;font-size:20px;">❤</span> by <a href="https://www.learningrobo.com/">Learning Robo</a></div> </body> </html>
CSS provides style to an HTML page. To make the page attractive create a CSS file with the name style.css and remember that you have to make a file with a .css 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;
  }
We hope you would like these Floating Buttons with Hover Animation using HTML & CSS.

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.

Thank you
Learning robo team

Post a Comment

Thank you
Learning robo team

Post a Comment (0)

Previous Post Next Post
Learning Robo says...
code copied
Welcome