JSFiddle - React, Tailwind, and code Playground
by 규연 황
HTML
<div class="boxed-option-item">
<span class="hover-lines"></span>
</div>
CSS
body {
background:#000000;
}
.boxed-option-item {
position: relative;
height:300px;
width: 300px;
box-sizing: border-box;
}
.boxed-option-item:before {
top: 0;
bottom: 0;
left: 0;
right: 0;
content: '';
position: absolute;
border: 1px solid #ffffff;
opacity: .3;
/* transition: all 150ms cubic-bezier(.19,1,.22,1); */
}
.boxed-option-item:not(:first-child):before {
/* left: -1px; */
/* border-left-width: 0; */
}
.boxed-option-item .hover-lines {
height: 0;
width: 0;
position: absolute;
bottom: 0;
left: 50%;
-webkit-transform: translate(-50%,0);
transform: translate(-50%,0);
box-sizing: border-box;
border-bottom: 2px solid #ffffff;
border-left: 0 solid #ffffff;
border-right: 0 solid #ffffff;
/*transition: width 200ms cubic-bezier(0.19, 1, 0.22, 1) 145ms,
height cubic-bezier(0.25, 0.25, 0.75, 0.75),
border-left-width cubic-bezier(0.25, 0.25, 0.75, 0.75),
border-right-width cubic-bezier(0.25, 0.25, 0.75, 0.75);*/
}
.boxed-option-item .hover-lines:after, .boxed-option-item .hover-lines:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 0;
height: 2px;
background: #ffffff;
transition: width 150ms cubic-bezier(.25,.25,.75,.75) 0s;
}
.boxed-option-item .hover-lines:after {
left: auto;
right: 0;
}
.boxed-option-item:hover .hover-lines {
height:100%;
width:100%;
border-left-width:2px;
border-right-width:2px;
transition:
width 150ms cubic-bezier(.25,.25,.75,.75),
height .1s cubic-bezier(.25,.25,.75,.75) 145ms,
border-left-width 0s cubic-bezier(.25,.25,.75,.75) 145ms,
border-right-width 0s cubic-bezier(.25,.25,.75,.75) 145ms
}
.boxed-option-item:hover .hover-lines:before, .boxed-option-item:hover .hover-lines:after {
width:50%;
transition:width .5s cubic-bezier(.19,1,.22,1) 340ms
}