پیشنمایش زنده
کد HTML
<a href="#" class="brutal-btn">
<div class="face static-face">
<span class="text">Start Project</span>
<svg
class="icon"
fill="none"
stroke="currentColor"
stroke-width="2.5"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M17 8l4 4m0 0l-4 4m4-4H3"
></path>
</svg>
</div>
<div class="face hover-face">
<div class="marquee-track">
<div class="marquee-half">
<span class="text">Let's Talk</span>
<svg
class="icon-small"
fill="none"
stroke="currentColor"
stroke-width="3"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M13 10V3L4 14h7v7l9-11h-7z"
></path>
</svg>
<span class="text">Let's Talk</span>
<svg
class="icon-small"
fill="none"
stroke="currentColor"
stroke-width="3"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M13 10V3L4 14h7v7l9-11h-7z"
></path>
</svg>
</div>
<div class="marquee-half">
<span class="text">Let's Talk</span>
<svg
class="icon-small"
fill="none"
stroke="currentColor"
stroke-width="3"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M13 10V3L4 14h7v7l9-11h-7z"
></path>
</svg>
<span class="text">Let's Talk</span>
<svg
class="icon-small"
fill="none"
stroke="currentColor"
stroke-width="3"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M13 10V3L4 14h7v7l9-11h-7z"
></path>
</svg>
</div>
</div>
</div>
</a>
کد CSS
@import url("s://api.fontshare.com/v2/css?f[]=clash-display@700,600,500&display=swap");
/* Base Button Structure */
.brutal-btn {
position: relative;
display: block;
width: 16rem;
height: 4rem;
border: 3px solid #0a0a0a; /* neutral-950 */
background-color: #0a0a0a;
color: white;
box-shadow: 6px 6px 0px 0px #ff3366;
transition: all 300ms ease-out;
overflow: hidden;
cursor: pointer;
font-family: "Clash Display", sans-serif;
outline: none;
text-decoration: none;
}
/* Hover and Active Mechanics */
.brutal-btn:hover {
transform: translate(6px, 6px);
box-shadow: none;
}
.brutal-btn:active {
/* Maintain the hover translation while shrinking the button */
transform: translate(6px, 6px) scale(0.97);
box-shadow: none;
}
/* Common Face Logic */
.face {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
align-items: center;
transition: transform 500ms cubic-bezier(0.85, 0, 0.15, 1);
}
/* Static Face Logic */
.static-face {
justify-content: space-between;
padding-left: 1.5rem;
padding-right: 1.5rem;
background-color: #0a0a0a;
z-index: 10;
}
.brutal-btn:hover .static-face {
transform: translateY(-100%);
}
/* Marquee Face Logic */
.hover-face {
background-color: #ff3366;
color: #0a0a0a;
transform: translateY(100%);
z-index: 20;
}
.brutal-btn:hover .hover-face {
transform: translateY(0);
}
/* Typography and Icon Sizing */
.text {
font-size: 1.125rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.1em;
white-space: nowrap;
}
.static-face .text {
color: white;
}
.icon {
width: 1.5rem;
height: 1.5rem;
color: white;
}
.icon-small {
width: 1.25rem;
height: 1.25rem;
flex-shrink: 0;
}
/* Marquee Animation Engine */
.marquee-track {
display: flex;
width: max-content;
animation: brutalMarquee 4s linear infinite;
}
.marquee-half {
display: flex;
align-items: center;
gap: 1.25rem;
padding-right: 1.25rem;
flex-shrink: 0;
}
@keyframes brutalMarquee {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-50%);
}
}