<label class="Switch">
  <div class="Switch-inner">
    <input type="checkbox">
    <div class="Switch-bg"></div>
    <div class="Switch-handle"></div>
  </div>
</label>
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  background: #24282c;
}

$color-positive: rgba(8,214,214,1);
$color-negative: rgba(231,98,57,1);

.Switch {
  display: inline-block;
  padding: 0;
  border: none;
  cursor: pointer;
}

.Switch-inner {
  display: inline-block;
  position: relative;
  overflow: hidden;
  width: 275px;
  height: 120px;
  border-radius: 99px;
  vertical-align: text-bottom;
  
  input {
    position: absolute;
    top: auto;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  
  input:checked ~ .Switch-bg {
    left: 0%;
  }

  input:checked ~ .Switch-handle {
    left: 20%;
  }
  
  input:checked ~ .Switch-handle {
    &::before {
      width: 30px;
      transform: translateY(calc(-50% + 10px)) translateX(calc(-50% - 28px)) rotate(45deg);
    }

    &::after {
      transform: translateY(-50%) translateX(-50%) rotate(-45deg);
    }
  }
}

.Switch-bg {
  position: absolute;
  left: -140%;
  width: 240%;
  height: 100%;
  background: linear-gradient(to right, $color-positive 0%, rgba(34,222,181,1) 40%, rgba(239,157,49,1) 60%, $color-negative 100%);
  transition: 0.5s left ease-out;
}

.Switch-handle {
  position: absolute;
  top: 50%;
  left: 60%;
  height: 64px;
  width: 64px;
  outline: none;
  transition: left 0.8s ease;
  transform: translateY(-50%);
}

.Switch-handle {
  &::before,
  &::after {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    height: 7px;
    width: 60px;
    border-radius: 99px;
    background-color: #ffffff;
    content: "";
    transition: 0.2s width ease, 0.2s transform ease;
  }

  &::before {
    transform: translateY(-50%) translateX(-50%) rotate(45deg);
  }
  
  &::after {
    transform: translateY(-50%) translateX(-50%) rotate(-45deg);
  }
}
View Compiled
/** 
 * Inspired by Switch from Nick Buturishvili
 * https://dribbble.com/shots/2272690-Switch
 */
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.