Skip to content

Instantly share code, notes, and snippets.

@dinhquochan
Last active September 15, 2017 04:46
Show Gist options
  • Save dinhquochan/3f1e4015db7a7e33cd0345eddcc1b0d7 to your computer and use it in GitHub Desktop.
Save dinhquochan/3f1e4015db7a7e33cd0345eddcc1b0d7 to your computer and use it in GitHub Desktop.
Call button with CSS & HTML
<a href="tel:<phone number>" title="" class="btn-call">
<span><i class="fa fa-phone"></i></span>
</a>
.btn-call{
position: fixed;
top: 100px;
right: 40px;
z-index: 9999;
}
.btn-call strong{
background: #76B82C;
display: inline-block;
border-radius: 8px 0 0 8px;
color: #fff;
font-size: 20px;
font-family: "OpenSans";
position: absolute;
right: 72px;
top: 50%;
height: 40px;
line-height: 40px;
margin-top: -20px;
margin-right: 15px;
opacity: 0;
pointer-events: none;
-webkit-transition: all .35s ease-in-out;
-moz-transition: all .35s ease-in-out;
-ms-transition: all .35s ease-in-out;
-o-transition: all .35s ease-in-out;
transition: all .35s ease-in-out;
min-width: 160px;
text-align: center;
font-weight: normal;
}
.btn-call strong:after{
width: 0;
height: 0;
border-top: 20px solid transparent;
border-left: 10px solid #76B82C;
border-bottom: 20px solid transparent;
content: '';
position: absolute;
left: 100%;
top: 0;
}
.btn-call:hover strong{
opacity: 1;
pointer-events: all;
margin-right: 0px;
}
.btn-call span{
display: block;
font-size: 42px;
width: 60px;
height: 60px;
margin: auto;
border-radius: 50% !important;
line-height: 60px;
text-align: center;
color: #fff;
background: #76B82C;
position: relative;
}
.btn-call span i{
animation-name: lac;
-webkit-animation-name: lac;
animation-duration: 1s;
-webkit-animation-duration: 1s;
animation-iteration-count: infinite;
-webkit-animation-iteration-count: infinite;
}
.btn-call span:before{
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 50%;
border: solid 1px rgba(118, 184, 44, 0.6);
animation-name: zoomin;
-webkit-animation-name: zoomin;
animation-name: zoomin;
-webkit-animation-name: zoomin;
animation-duration: 1.5s;
-webkit-animation-duration: 1.5s;
animation-iteration-count: infinite;
-webkit-animation-iteration-count: infinite;
}
.btn-call span:after{
content: '';
position: absolute;
top: -10px;
left: -10px;
right: -10px;
bottom: -10px;
border-radius: 50%;
background: rgba(118, 184, 44, 0.6);
z-index: -1;
animation-name: zoomout;
-webkit-animation-name: zoomout;
animation-duration: 1s;
-webkit-animation-duration: 1s;
animation-iteration-count: infinite;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
animation-direction: alternate;
}
@keyframes lac {
0% {transform: rotate(0deg);}
10% {transform: rotate(-25deg);}
20% {transform: rotate(25deg);}
30% {transform: rotate(-25deg);}
40% {transform: rotate(25deg);}
50% {transform: rotate(0deg);}
100% {transform: rotate(0deg);}
}
@-webkit-keyframes lac {
0% {-webkit-transform: rotate(0deg);}
10% {-webkit-transform: rotate(-25deg);}
20% {-webkit-transform: rotate(25deg);}
30% {-webkit-transform: rotate(-25deg);}
40% {-webkit-transform: rotate(25deg);}
50% {-webkit-transform: rotate(0deg);}
100% {-webkit-transform: rotate(0deg);}
}
@keyframes zoomin{
0%{transform: scale(.8);opacity: 1;}
100%{transform: scale(2.2);opacity: .1;}
}
@-webkit-keyframes zoomin{
0%{-webkit-transform: scale(.8);opacity: 1;}
100%{-webkit-transform: scale(2.2);opacity: .1;}
}
@keyframes zoomout{
0%{transform: scale(0.8);opacity: 1;}
100%{transform: scale(1.1);opacity: .3}
}
@-webkit-keyframes zoomout{
0%{-webkit-transform: scale(0.8);opacity: 1;}
100%{-webkit-transform: scale(1.1);opacity: .3;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment