پیشنمایش زنده
کد HTML
<button class="button">
<span class="text">Button</span>
<div class="circle-container">
<div class="circle"></div>
</div>
</button>
کد CSS
.button {
position: relative;
display: inline-block;
padding: 12px 24px;
border: none;
outline: none;
border-radius: 50px;
background-color: #F06C9B;
color: #fff;
font-size: 16px;
font-weight: bold;
cursor: pointer;
overflow: hidden;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #F26D5F;
}
.button .text {
position: relative;
z-index: 2;
}
.circle-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.circle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 0;
height: 0;
background-color: #FAD779;
border-radius: 50%;
opacity: 0.5;
transition: all 0.5s ease;
}
.button:hover .circle {
width: 200%;
height: 200%;
transform: translate(-50%, -50%) scale(1);
opacity: 0;
}
.button:focus {
box-shadow: 0 0 0 2px #FF8D55;
outline: none;
}
.button.animated .circle {
animation: pulse 1s infinite;
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(250, 215, 121, 0.4);
}
70% {
box-shadow: 0 0 0 10px rgba(250, 215, 121, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(250, 215, 121, 0);
}
}