Material Design: Ripple Button
Pure CSS ripple button
by Saksham Malhotra
HTML
<button>Click</button>
CSS
/* Material style */
button {
border: none;
cursor: pointer;
color: white;
padding: 15px 40px;
border-radius: 2px;
font-size: 22px;
box-shadow: 2px 2px 4px rgba(0, 0, 0, .4);
background: #2196F3;
}
/* Ripple magic */
button {
position: relative;
overflow: hidden;
}
button:after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 5px;
height: 5px;
background: rgba(255, 255, 255, .5);
border-radius: 100%;
transform: scale(0, 0);
}
@keyframes ripple {
20% {
transform: scale(25, 25);
opacity: 1;
}
100% {
opacity: 0;
transform: scale(40, 40);
}
}
button:focus::after {
animation: ripple 1s ease-out;
}