پیش‌نمایش زنده
کد HTML
<label class="container">
  <input checked="checked" type="checkbox">
  <div class="checkmark"></div>
</label>
کد CSS
/* Hide the default checkbox */
.container input {
 position: absolute;
 opacity: 0;
 cursor: pointer;
 height: 0;
 width: 0;
}

.container {
 display: block;
 position: relative;
 cursor: pointer;
 font-size: 20px;
 user-select: none;
}

/* Create a custom checkbox */
.checkmark {
 position: relative;
 top: 0;
 left: 0;
 height: 1.3em;
 width: 1.3em;
 background-color: #343434;
 border-radius: 5px;
 transition: all 0.5s;
}

/* When the checkbox is checked, add a blue background */
.container input:checked ~ .checkmark {
 background-color: #f0f0f0;
 border: 2px solid #343434;
}

/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
 content: "";
 position: absolute;
 display: none;
 filter: drop-shadow(0 0 10px #888);
}

/* Show the checkmark when checked */
.container input:checked ~ .checkmark:after {
 display: block;
}

/* Style the checkmark/indicator */
.container .checkmark:after {
 left: 0.3em;
 top: 0.05em;
 width: 0.3em;
 height: 0.65em;
 border: solid #343434;
 border-width: 0 0.2em 0.2em 0;
 border-radius: 4px;
 transform: rotate(45deg);
 animation: bounceFadeIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes bounceFadeIn {
 from {
  transform: translate(0, -10px) rotate(45deg);
  opacity: 0;
 }

 to {
  transform: translate(0, 0) rotate(45deg);
  opacity: 1;
 }
}
نوع: checkbox
تاریخ ایجاد: 2026/06/05
آخرین بروزرسانی: 2026/06/05