پیش‌نمایش زنده
کد HTML
<label class="container">
  <input 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;
  border: 4px solid black;
  padding: 6px;
}

/* Create a custom checkbox */
.checkmark {
  position: relative;
  top: 0;
  left: 0;
  height: 0.9em;
  width: 0.9em;
  /* background-color: transparent; */
  transition: 0.1s ease-in-out;
}

/* When the checkbox is checked, add a blue background */
.container input:checked ~ .checkmark {
  background-color: #000000;
}

.container:hover .checkmark {
  background-color: #ccc;
}

/* Create the checkmark/indicator (hidden when not checked) */
/* .checkmark:after {
  content: "";
  position: absolute;
  display: none;
} */

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

/* Style the checkmark/indicator */
.container .checkmark:after {
  left: 0.45em;
  top: 0.25em;
  width: 0.25em;
  height: 0.5em;
  border: solid white;
  border-width: 0 0.15em 0.15em 0;
  transform: rotate(45deg);
}
نوع: checkbox
تاریخ ایجاد: 2026/06/05
آخرین بروزرسانی: 2026/06/05