JSFiddle - React, Tailwind, and code Playground
by Ayri Rin
HTML
<a href="">text</a>
<button class="btn btn_material">Button</button>
SCSS
html {
background-color: #444;
font: normal 16px sans-serif;
* {
margin: 0;
padding: 0;
height: 100px;
}
}
body {
display: flex;
flex-direction: column;
}
a {
position: relative;
z-index: 1;
display: flex;
width: 250px;
height: 50px;
align-items: center;
justify-content: center;
margin: 10px auto;
background-color: greenyellow;
border-radius: 5px;
line-height: 50px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
color: black;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: -1;
display: block;
width: 10px;
height: 10px;
margin: 20px auto 0;
background-color: white;
border-radius: 10px;
opacity: 0;
}
&:hover {
&::before {
transform: scale(30);
transition: .5s;
animation: mymove .5s;
}
}
}
@keyframes mymove {
0% {opacity: .1;}
50% {opacity: .5;}
100% {opacity: 0;}
}
.btn {
margin: 10px auto;
background: transparent;
border: 2px solid purple;
color: purple;
display: inline-block;
margin: 0;
padding: 8px 16px;
}
.btn_material {
overflow: hidden;
position: relative;
}
.btn_material:after {
background: purple;
border-radius: 50%;
content: "";
height: 1px;
left: 50%;
position: absolute;
top: 50%;
width: 1px;
transform: translateX(-50%) translateY(-50%);
}
.btn_material:active {
&:after {
height: 50px;
width: 50px;
animation: ripple 1s;
}
}
@keyframes ripple {
from {
transform: scale(1);
opacity: 0.4;
}
to {
transform: scale(100);
opacity: 0;
}
}