Skip to content

Instantly share code, notes, and snippets.

@dav0r
Created September 17, 2019 12:25
Show Gist options
  • Save dav0r/3e016bef30ce8d53c6958a919823c726 to your computer and use it in GitHub Desktop.
Save dav0r/3e016bef30ce8d53c6958a919823c726 to your computer and use it in GitHub Desktop.
Simple button ripple click effect
// Button ripple effect
// similar to Google's material design
.btn-ripple {
position: relative;
overflow: hidden;
&::after {
display: none;
content: "";
position: absolute;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.3);
width: 100px;
height: 100px;
margin-top: -50px;
margin-left: -50px;
top: 50%;
left: 50%;
animation: ripple 1s;
opacity: 0;
}
&:focus:not(:active)::after {
display: block;
}
}
@keyframes ripple {
from {
opacity: 1;
transform: scale(0);
}
to {
opacity: 0;
transform: scale(10);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment