پیشنمایش زنده
کد HTML
<label class="checkbox-container">
<input type="checkbox" />
<span class="checkmark"></span>
</label>
کد CSS
.checkbox-container {
display: inline-block;
position: relative;
width: 50px;
height: 50px;
cursor: pointer;
user-select: none;
}
.checkbox-container input {
position: absolute;
opacity: 0;
cursor: pointer;
}
.checkmark {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #f0f0f0;
border-radius: 50%;
box-shadow:
0 4px 8px rgba(0, 0, 0, 0.2),
inset 0 4px 6px rgba(255, 255, 255, 0.5);
transition:
background-color 0.3s ease,
box-shadow 0.3s ease;
}
.checkbox-container input:checked ~ .checkmark {
background-color: #007bff;
box-shadow:
inset 0 6px 12px rgba(0, 0, 0, 0.2),
0 4px 8px rgba(0, 0, 0, 0.1);
}
.checkbox-container input:checked ~ .checkmark:after {
display: block;
}
.checkmark:after {
content: "";
position: absolute;
display: none;
top: 50%;
left: 50%;
width: 18px;
height: 18px;
background-color: white;
border-radius: 50%;
transform: translate(-50%, -50%) scale(0);
transition: transform 0.3s ease;
}
.checkbox-container input:checked ~ .checkmark:after {
transform: translate(-50%, -50%) scale(1);
}