<input type="checkbox">
html,body {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

input {

  &[type="checkbox"] {
    position: relative;
    width: 80px;
    height: 40px;
    background: #ccc;
    outline: none;
    border-radius: 20px;
    appearance: none;

    &:before {
      content: '';
      position: absolute;
      width: 36px;
      height: 36px;
      border-radius: 20px;
      top: 2px;
      left: 2px;
      background: #fff;
      transition: .2s;
    }

    &:checked {
      background: #03a9f4;

      &:before {
        left: 42px;
      }
    }
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.