<input type="checkbox" toggle>
input[type=checkbox][toggle] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance:none;
  background-color:#ccc;
  border-radius: 1em;
  cursor: pointer;
  display: inline-block;
  font-size:inherit;
  height: 1.25em;
  margin: 0;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: all .2s ease;
  width: 2.25em;
  &:before {
    background-color: #fff;
    border-radius: 50%;
    content: "";
    height: 1em;
    left: .125em;
    position: absolute;
    top: .125em;
    transition: all .2s ease-in-out;
    width: 1em;
  }
  &:checked {
    background: #6a4;
    opacity:1;
    &:before {
      transform: translateX(1em);
    }
    &:active {
      transform:rotate(-15deg);
    }
  }
  &:disabled {
    color:#ccc;
    cursor:default;
  }
  &:indeterminate {
    &:before {
      transform: translateX(.5em);
    }
  }
  &:active {
    transform:rotate(15deg);
  }
  &:hover {
    opacity:.8;
  }
  &:focus {
    outline:none;
  }
}

// pen only centering
body {
  align-items: center;
  display: flex;
  height: 100vh;
  justify-content: center;
  margin:0;
}
View Compiled
  // based on https://codepen.io/andreasstorm/pen/jOEpBLW

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.