پیشنمایش زنده
کد HTML
<button class="button">hover me !</button>
کد CSS
.button {
display: inline-block;
padding: 12px 24px;
font-size: 16px;
font-weight: bold;
text-transform: uppercase;
color: rgb(255, 255, 255);
background-color: #000000;
border: none;
border-radius: 50px;
transition: background-color 0.3s ease, transform 0.2s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
cursor: pointer;
position: relative;
overflow: hidden;
z-index: 1;
}
.button::before {
content: "";
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background-color: rgba(0, 0, 0, 0.26);
border-radius: 50%;
transform: translate(-50%, -50%);
transition: all 0.4s ease;
z-index: -1;
}
.button::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: linear-gradient(45deg, rgba(2, 2, 2, 0.418) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.507) 50%, rgba(0, 0, 0, 0.315) 75%, transparent 75%, transparent);
background-size: 30px 30px;
opacity: 0;
transition: opacity 0.4s ease;
}
.button:hover {
color: rgb(73, 70, 70);
background-color: #fdfafa;
transform: scale(1.1) rotate(5deg);
box-shadow: 0 8px 12px rgba(0, 0, 0, 0.3);
}
.button:hover::before {
top: 50%;
left: 50%;
width: 100%;
height: 100%;
transform: translate(-50%, -50%) rotate(45deg);
}
.button:hover::after {
opacity: 1;
}
.button:active {
background-color: #fffbfd;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
transform: translateY(2px);
}