Customization of checkbox style

by Julien Roche

HTML

<label class="form">
	<input type="checkbox" class="form__checkbox" checked="checked" />
	<span class="form__label">Something</span>
</label>

CSS

.form {
  cursor: pointer;
  position: relative;
}

.form__label {
  font-size: 14px;
  line-height: 24px;
  margin-left: 28px;
}

.form__checkbox {
  opacity: 0;
  position: absolute;
  z-index: -1;
}

.form__checkbox + *::before {
  border: 2px solid #434343;
  border-radius: 3px;
  content: '';
  height: 24px;
  left: -5px;
  position: absolute;
  width: 24px;
}

.form__checkbox:checked + *::before {
  background-color: #B10043;
  border-color: #B10043;
}
    
.form__checkbox:checked + *::after {
  color: white;
  content: 'X';
  font-size: 20px;
  left: 2px;
  position: absolute;
  top: 0px;
}