پیشنمایش زنده
کد HTML
<div class="card">
<div class="card__content">
<div class="hover-text">Explore</div>
</div>
<div class="blob blob1"></div>
<div class="blob blob2"></div>
<div class="blob blob3"></div>
<div class="blob blob4"></div>
</div>
کد CSS
.card {
position: relative;
width: 190px;
height: 254px;
background: lightgrey;
box-shadow: #d11bff42 0 15px 40px -5px;
z-index: 0;
border-radius: 21px;
overflow: hidden;
}
.card__content {
background: linear-gradient(
rgba(255, 255, 255, 0.473),
rgba(150, 150, 150, 0.25)
);
z-index: 1;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border-radius: 21px;
pointer-events: none;
display: flex;
justify-content: center;
align-items: center;
}
.hover-text {
font-family: "Segoe UI", sans-serif;
font-size: 1.2rem;
color: #eadede;
opacity: 0;
transform: translateY(10px);
transition:
opacity 0.5s ease,
transform 0.5s ease;
z-index: 2;
pointer-events: none;
}
.card:hover .hover-text {
opacity: 1;
transform: translateY(0);
}
.blob {
position: absolute;
z-index: 0;
border-radius: 5em;
width: 200px;
height: 200px;
opacity: 0.6;
filter: blur(20px);
}
/* Initial blob positions and colors */
.blob1 {
left: -50px;
top: -90px;
background: #ff930fe7;
}
.blob2 {
left: 110px;
top: -20px;
background: #bf0fff;
}
.blob3 {
left: -40px;
top: 100px;
background: #ff1b6b;
}
.blob4 {
left: 100px;
top: 180px;
background: #0061ff;
}
/* Animations triggered on card hover */
.card:hover .blob1 {
animation: float1 6s linear infinite alternate;
}
.card:hover .blob2 {
animation: float2 6s linear infinite alternate;
}
.card:hover .blob3 {
animation: float3 6s linear infinite alternate;
}
.card:hover .blob4 {
animation: float4 6s linear infinite alternate;
}
/* Keyframes */
@keyframes float1 {
from {
transform: translate(0, 0);
}
to {
transform: translate(40px, 30px);
}
}
@keyframes float2 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-30px, 40px);
}
}
@keyframes float3 {
from {
transform: translate(0, 0);
}
to {
transform: translate(50px, -30px);
}
}
@keyframes float4 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-40px, -40px);
}
}