Animasi yang akan menampilkan slide effect pada button.
<a href="#"> button <span></span> </a>
* {
box-sizing: border-box;
}
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: sans-serif;
overflow: hidden;
}
a {
text-decoration: none;
width: 160px;
height: 60px;
color: black;
line-height: 60px;
text-align: center;
text-transform: capitalize;
font-size: 25px;
position: relative;
transition: all 0.2s;
overflow: hidden;
}
a span {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: transparent;
border: 2px solid black;
z-index: -1;
}
span:before {
content: "";
position: absolute;
width: 8%;
height: 500%;
background-color: white;
top: 50%;
left: 50%;
transition: all 0.2s;
transform: translate(-50%, -50%) rotate(-60deg);
}
a:hover span:before {
width: 100%;
background-color: black;
transform: translate(-50%, -50%) rotate(60deg);
}
a:hover {
color: white;
}