JSFiddle - React, Tailwind, and code Playground
HTML
<button class="btn">Кнопка</button>
SCSS
@mixin beveled-corners($bg, $tl:0, $tr:$tl, $br:$tl, $bl:$tr) {
background:
linear-gradient(135deg, transparent $tl, $bg 0) top left,
linear-gradient(225deg, transparent $tr, $bg 0) top right,
linear-gradient(-45deg, transparent $br, $bg 0) bottom right,
linear-gradient(45deg, transparent $bl, $bg 0) bottom left;
background-size: 50% 50%;
background-repeat: no-repeat;
}
.btn {
position: relative;
text-decoration: none;
color: #000;
padding: 13px 38px;
@include beveled-corners(#fff, 0, 10px, 0, 10px);
text-align: center;
letter-spacing: 0.9px;
transition: 0.2s ease-out;
cursor: pointer;
border: none;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
justify-content: center;
align-items: center;
vertical-align: middle;
z-index: 1;
&::before {
content: "";
position: absolute;
top: -2px;
left: -2px;
width: calc(100% + 4px);
height: calc(100% + 4px);
@include beveled-corners(#999, 0, 10px, 0, 10px);
z-index: -2;
pointer-events: none;
transition: 0.2s ease-in-out;
}
&::after {
content: "";
position: absolute;
top: -2px;
left: -2px;
width: calc(100% + 4px);
height: calc(100% + 4px);
@include beveled-corners(#ff9800, 0, 10px, 0, 10px);
z-index: -1;
opacity: 0;
pointer-events: none;
transition: 0.2s ease-in-out;
}
&:hover, &:active{
color: #fff;
&::after {
opacity: 1;
}
}
}