btn_hover_circle
by Nic Fontaine
HTML
<div class='btn'>BUTTON</div>
CSS
body {
text-align: center;
}
div.btn {
background: #888;
color: #fff;
padding: 20px 25px;
display: inline-block;
font-family: sans-serif;
border-radius: 6px;
cursor: pointer;
position: relative;
z-index: 0;
overflow: hidden;
transition: background 0.1s 0.1s;
box-shadow: inset 0 -2px 9px rgba(0,0,0,0.4);
box-sizing: content-box;
/* border: 3px solid #666; */
margin: 20% auto 0;
}
div.btn:hover {
background: #aaa;
padding-top: 19px;
padding-bottom: 18px;
border-bottom: 3px solid #888;
text-shadow: 0 1px 1px rgba(0,0,0,0.2);
box-shadow: 0 2px 2px rgba(0,0,0,0.2);
}
div.btn:before {
animation: btnGrowNull 0.01s;
}
div.btn:hover:before {
content: '';
width: 40px;
height: 40px;
background: #aaa;
position: absolute;
right: 0; left: 0; top: 0; bottom: 0;
margin: 0 auto;
top: 50%;
transform: translateY(-50%) scale(1,1);
z-index: -1;
border-radius: 50%;
animation-fill-mode: forwards;
animation: btnGrow 0.15s linear;
transform-origin: 50% 50%;
opacity: 0;
}
@keyframes btnGrowNull {
from { opacity: 0; }
to { opacity: 0; }
}
@keyframes btnGrow {
0% { transform: translateY(-50%) scale3d(1,1,1); opacity: 0.5; }
99% { transform: translateY(-50%) scale3d(4,4,1); opacity: 1; }
100% { opacity: 0; }
}