<div class="outer">
  <h3>チェックボックスにスタイルをつける</h3>
  <span class="form-checkbox-outer">
  <input type="checkbox" id="item1"><label for="item1" class="form-checkbox">押せる</label>
  </span>
  
  <span class="form-checkbox-outer">
  <input type="checkbox" id="item2" disabled><label for="item2" class="form-checkbox">押せない(disabled)</label>
  </span>
</div>
.outer {
  margin: 20px;
}

input {
  /* Reset スタイルをリセット */
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.form-checkbox-outer {
  display: inline-block;
  position: relative;
}
.form-checkbox::before {
  display: inline-block;
  content: '';
  width: 10px;
  height: 10px;
  border: 1px solid #9e9e9e;
  margin-right: 5px;
}
:checked + .form-checkbox::after {
  position: absolute;
  left: 4px;
  top: 5px;
  content: '';
  width: 4px;
  height: 8px;
  border-bottom: 2px solid #00bcd4;
  border-right: 2px solid #00bcd4;
  transform: rotate(45deg);
}
:disabled + .form-checkbox::before {
  border-color: #eee;
  background-color: #eee;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.