پیشنمایش زنده
کد HTML
<button>
<div class="default-btn">
<svg
viewBox="0 0 24 24"
width="20"
height="20"
stroke="#FFF"
stroke-width="2"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
class="css-i6dzq1"
>
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
<span>Quick View</span>
</div>
<div class="hover-btn">
<svg
viewBox="0 0 24 24"
width="20"
height="20"
stroke="#ffd300"
stroke-width="2"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
class="css-i6dzq1"
>
<circle cx="9" cy="21" r="1"></circle>
<circle cx="20" cy="21" r="1"></circle>
<path
d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"
></path>
</svg>
<span>Shop Now</span>
</div>
</button>
کد CSS
button {
color: rgb(253, 119, 119);
position: relative;
overflow: hidden;
outline: none;
cursor: pointer;
border-radius: 50px;
background-color: hsl(118, 94%, 32%);
border: solid 4px hsl(0, 0%, 100%);
font-family: inherit;
}
.default-btn,
.hover-btn {
background-color: hsl(118, 94%, 32%);
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
align-items: center;
gap: 15px;
padding: 15px 20px;
border-radius: 50px;
font-size: 17px;
font-weight: 500;
text-transform: uppercase;
transition: all 0.6s ease;
}
.hover-btn {
position: absolute;
inset: 0;
background-color: hsl(0, 0%, 0%);
transform: translate(0%, 100%);
}
.default-btn span {
color: hsl(0, 0%, 100%);
}
.hover-btn span {
color: hsl(0, 0%, 100%);
}
button:hover .default-btn {
transform: translate(0%, -100%);
}
button:hover .hover-btn {
transform: translate(0%, 0%);
}
.css-i6dzq1 {
color: black;
}