JSFiddle - React, Tailwind, and code Playground
by Trina Lu
HTML
<button class="box">
<div>button hover effect</div>
</button>
SCSS
.box {
background: #FFF;
transition: 1s all;
border: 0;
padding: 0;
position: relative;
}
.box div {
padding: 10px;
position: relative;
}
.box:before,
.box:after,
.box div:before,
.box div:after {
position: absolute;
content: "";
background: red;
transition: 0.5s all;
}
.box:before {
width: 0%;
height: 1px;
top: 0;
left: 0;
}
.box:after {
top: 0;
height: 0%;
width: 1px;
left: 0;
}
.box div:before {
width: 0%;
height: 1px;
bottom: 0;
right: 0;
}
.box div:after {
bottom: 0;
height: 0%;
width: 1px;
right: 0;
}
.box:hover {
&:after,
& div:after {
height: 100%;
}
&:before,
& div:before {
width: 100%;
}
}