<div class="ios-toggle">
  <input type="checkbox" id="ios-toggle" /><label for="ios-toggle" />
</div>
.ios-toggle {
  box-sizing: border-box;
  display: inline-block;
  font-size: 50px;
  width: 5.3em;
}
.ios-toggle input,
.ios-toggle input:active {
  border: 0;
  height: 0;
  opacity: 0;
  outline: none;
  position: absolute;
  left: -5000px;
  width: 0;
}
.ios-toggle label {
  background: #f8f8f8;
  border: 0.2em solid #ddd;
  border-radius: 1.6em;
  box-sizing: border-box;
  cursor: pointer;
  display: block;
  height: 3.2em;
  padding: 1em;
  position: relative;
  transition: 0.3s ease-out;
  width: 100%;
}
.ios-toggle label::before {
  background: #ffffff;
  border-radius: 1.4em;
  box-shadow: 0 0.3em 0.3em rgba(0, 0, 0, 0.2), 0 0 0 0.1em #ddd;
  content: "";
  display: block;
  height: 2.8em;
  left: 0;
  position: absolute;
  right: auto;
  text-indent: 4em;
  top: 0;
  transition: 0.25s ease-in-out;
  width: 2.8em;
  z-index: 2;
}
.ios-toggle label::after {
  background: #f8f8f8;
  border-radius: 1.4em;
  content: "";
  display: block;
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  transition: 0.25s ease-in-out;
  width: 2.8em;
  z-index: 1;
}
.ios-toggle input:active + label::before {
  width: 3.2em;
}
.ios-toggle input:checked + label {
  border-color: #13bf11;
  box-shadow: inset 0 0 0 2em #13bf11;
}
.ios-toggle input:checked + label::after {
  background-color: #13bf11;
  right: 1.4em;
  width: 100%;
}
.ios-toggle input:checked + label::before {
  box-shadow: 0 0 0 0.1em transparent, 0 0.3em 0.3em rgba(0, 0, 0, 0.3);
  left: calc(100% - 2.8em);
}
.ios-toggle input:checked:active + label::before {
  left: calc(100% - 3.2em);
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.