JSFiddle - React, Tailwind, and code Playground

by satantx

HTML

<div class="button">
    нажать кнопку
    <span class="top"></span>
    <span class="bottom"></span>
    <span class="left"></span>
    <span class="right"></span>
</div>

CSS

.button {
    position: relative;
    width: 220px;
    height: 40px;
    border: 2px solid #ccc;
    cursor: pointer;
    text-align: center;
    line-height: 40px;
}

.button span {
    position: absolute;
    background: #7C7C7C;
    transition: all 350ms ease;
}

.button span.left {
    width: 2px;
    height: 0;
    left: -2px; top: -2px;
}

.button:hover span.left,
.button:hover span.right{
    height: 44px;
}

.button span.right {
    width: 2px;
    height: 0;
    right: -2px; bottom: -2px;
}

.button span.top {
    height: 2px;
    width: 0;
    right: -2px; top: -2px;    
}

.button:hover span.top,
.button:hover span.bottom{
    width: 224px;
}

.button span.bottom {
    height: 2px;
    width: 0;
    left: -2px; bottom: -2px;
}