پیشنمایش زنده
کد HTML
<button class="button">AnshX</button>
کد CSS
.button {
display: inline-block;
width: 140px;
height: 40px;
border: none;
border-radius: 10px;
font-size: 1em;
font-weight: bold;
text-transform: uppercase;
text-align: center;
text-decoration: none;
color: #ffd277;
background: linear-gradient(90deg, #402fb5, #cf30aa, #402fb5);
background-size: 250%;
background-position: left;
position: relative;
cursor: pointer;
overflow: hidden;
transition:
transform 0.2s ease,
box-shadow 0.2s ease,
background-position 1s;
box-shadow:
0 0 0.5em rgba(0, 0, 0, 0.5),
0 0 1em #cf30aa,
0 0 1.5em #402fb5;
}
.button::before {
content: "Love coding";
position: absolute;
top: 0;
left: 0;
width: 97%;
height: 90%;
border-radius: 8px;
color: #ffd277;
background-color: rgba(0, 0, 0, 0.842);
background-size: 200%;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
transition: background-position 1s;
}
.button:hover {
transform: translateY(-0.1em);
background-position: right;
box-shadow:
0 0 1em rgba(0, 0, 0, 0.7),
0 0 1.5em #cf30aa,
0 0 2em #402fb5;
}
.button:hover::before {
background-position: right;
}
.button:active {
transform: scale(0.95);
box-shadow:
0 0 0.5em rgba(0, 0, 0, 0.5),
0 0 1em #cf30aa,
0 0 1.5em #402fb5;
}
/* Grid Glow Effect */
.button::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(
to bottom right,
rgba(255, 255, 255, 0.3) 25%,
transparent 25%,
transparent 50%,
rgba(255, 255, 255, 0.3) 50%,
rgba(255, 255, 255, 0.3) 75%,
transparent 75%
);
background-size: 15px 15px;
opacity: 0.4;
border-radius: 10px;
z-index: 0;
pointer-events: none;
transition: opacity 0.3s;
}
.button:hover::after {
opacity: 0.7;
}