3D кнопка, проблема с реализацией border
Как можно реализовать бордер как показан на картинке ниже? Толкового ничего в голову не лезет
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@600&display=swap");
.button {
position: absolute;
left: 50%;
top: 50%;
display: inline-block;
padding: 15px 21px;
border: none;
font-family: "Inter", sans-serif;
font-weight: 600;
font-size: 16px;
line-height: 1.3;
color: #fff;
background-color: #e37373;
transform: translate(-50%, -50%);
transition: all 0.5s;
}
.button::before {
content: "";
position: absolute;
left: 4px;
bottom: -8px;
width: 100%;
height: 8px;
background-color: #e37373;
transform: skewX(45deg);
}
.button::after {
content: "";
position: absolute;
right: -8px;
bottom: -4px;
width: 8px;
height: 100%;
background-color: #e37373;
transform: skewY(45deg);
}
<button class="button" type="button" >Press me!</button>
Ответы (1 шт):
Автор решения: Vladimir Gonchar
→ Ссылка
Можно примерно вот так:
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@600&display=swap");
.button {
position: absolute;
left: 50%;
top: 50%;
display: inline-block;
padding: 15px 21px;
border: none;
font-family: "Inter", sans-serif;
font-weight: 600;
font-size: 16px;
line-height: 1.3;
color: #fff;
background-color: #e37373;
transform: translate(-50%, -50%);
transition: all 0.25s;
border: 2px solid #114424;
}
.button::before {
content: "";
position: absolute;
left: 3.5px;
bottom: 0;
width: 100%;
height: 8px;
background: linear-gradient(90deg, #114424 50%, #e37373 50%);
background-size: 7px 100%;
transform: translateY(100%) skewX(45deg);
border: 2px solid #114424;
}
.button::after {
content: "";
position: absolute;
right: 0;
bottom: -7.5px;
width: 8px;
height: 100%;
background: linear-gradient(0deg, #114424 50%, #e37373 50%);
background-size: 100% 7px;
background-position: 10px;
transform: translateX(100%) skewY(45deg);
border: 2px solid #114424;
}
/* переход состояния :active */
.button::before,
.button::after { transition: all 0.25s; }
.button:active {
transform: translate(calc(-50% + 3px), calc(-50% + 3px));
}
.button:active::before {
transform: translate(-1.5%, 90%) skewX(47deg) scaleY(0.6);
}
.button:active::after {
transform: translate(90%, -2.5%) skewY(47deg) scaleX(0.6);
}
<button class="button" type="button" >Press me!</button>
