پیشنمایش زنده
کد HTML
<label class="checkbox-wrapper">
<input checked="" type="checkbox" />
<div class="checkbox"></div>
</label>
کد CSS
.checkbox-wrapper {
position: relative;
cursor: pointer;
width: 80px;
height: 80px;
transform-style: preserve-3d;
transition: transform 0.5s ease;
}
.checkbox-wrapper:hover {
transform: rotateX(10deg) rotateY(10deg);
}
.checkbox-wrapper input {
opacity: 0;
position: absolute;
width: 100%;
height: 100%;
cursor: pointer;
z-index: 2;
}
.checkbox {
position: relative;
width: 100%;
height: 100%;
background: #2c2c2c;
border-radius: 20px;
box-shadow:
0 8px 16px rgba(0, 0, 0, 0.3),
inset 0 -8px 16px rgba(0, 0, 0, 0.2),
inset 0 8px 16px rgba(255, 255, 255, 0.1);
overflow: hidden;
transition: all 0.3s ease;
transform-style: preserve-3d;
}
.checkbox::before {
content: "";
position: absolute;
width: 150%;
height: 150%;
top: -25%;
left: -25%;
background: linear-gradient(45deg, #00ff87, #60efff, #00ff87, #60efff);
background-size: 300% 300%;
border-radius: 20px;
opacity: 0;
transform-origin: center;
transform: scale(0) rotate(180deg);
transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.checkbox::after {
content: "✓";
position: absolute;
top: 50%;
left: 50%;
color: white;
font-size: 40px;
font-weight: bold;
text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
opacity: 0;
transform: translate(-50%, -50%) scale(0.5) rotate(-45deg);
transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
z-index: 1;
}
.checkbox-wrapper:hover .checkbox {
transform: translateY(-5px) translateZ(10px);
box-shadow:
0 15px 25px rgba(0, 0, 0, 0.4),
inset 0 -8px 16px rgba(0, 0, 0, 0.2),
inset 0 8px 16px rgba(255, 255, 255, 0.1);
}
.checkbox-wrapper input:checked ~ .checkbox::before {
opacity: 1;
transform: scale(1) rotate(0deg);
animation: gradientMove 3s linear infinite;
}
.checkbox-wrapper input:checked ~ .checkbox::after {
opacity: 1;
transform: translate(-50%, -50%) scale(1) rotate(0deg);
filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
transition-delay: 0.2s;
}
.checkbox-wrapper input:checked ~ .checkbox {
transform: translateY(-5px) translateZ(20px);
animation: glowPulse 2s infinite;
}
@keyframes gradientMove {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
@keyframes glowPulse {
0%,
100% {
box-shadow:
0 15px 25px rgba(0, 0, 0, 0.4),
inset 0 -8px 16px rgba(0, 0, 0, 0.2),
inset 0 8px 16px rgba(255, 255, 255, 0.1),
0 0 20px rgba(96, 239, 255, 0.5);
}
50% {
box-shadow:
0 15px 25px rgba(0, 0, 0, 0.4),
inset 0 -8px 16px rgba(0, 0, 0, 0.2),
inset 0 8px 16px rgba(255, 255, 255, 0.1),
0 0 40px rgba(0, 255, 135, 0.8);
}
}
.checkbox-wrapper input:active ~ .checkbox::before {
transition: 0s;
opacity: 0.5;
}