Coder Wrap provides free to use snippets Coder Wrap provides free to use snippets

Back to CSS3
Preview Source Code
Download
HTML
CSS
 /**Typeo CSS Start**/
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');
*{ box-sizing: border-box;}

body {
  font-family: "Poppins", sans-serif;
  color: #444;
  box-sizing: border-box;
  background-color: #f5f5f5;
}
/**Typeo CSS End**/
.checkbox-toggle {
  padding: 4%;
  max-width: 500px;
  width: 100%;
  margin:auto; 
}
.ext-cross:before, .checkbox__checker:before, .checkbox__cross:before, .checkbox__ok:before, .ext-cross:after, .checkbox__checker:after, .checkbox__cross:after, .checkbox__ok:after {
  content: "";
  display: block;
  position: absolute;
  width: 14px;
  height: 2px;
  margin: 0 auto;
  top: 20px;
  left: 0;
  right: 0;
  background-color: #bf1e1e;
  border-radius: 5px;
  transition-duration: 0.3s;
}
.ext-cross:before, .checkbox__checker:before, .checkbox__cross:before, .checkbox__ok:before {
  transform: rotateZ(45deg);
}
.ext-cross:after, .checkbox__checker:after, .checkbox__cross:after, .checkbox__ok:after {
  transform: rotateZ(-45deg);
}

.ext-ok:before, .checkbox__ok:before, .checkbox__toggle:checked + .checkbox__checker:before, .ext-ok:after, .checkbox__ok:after, .checkbox__toggle:checked + .checkbox__checker:after {
  background-color: #0cb018;
}
.ext-ok:before, .checkbox__ok:before, .checkbox__toggle:checked + .checkbox__checker:before {
  width: 6px;
  top: 23px;
  left: -7px;
}
.ext-ok:after, .checkbox__ok:after, .checkbox__toggle:checked + .checkbox__checker:after {
  width: 12px;
  left: 5px;
}

.checkbox {
  width: 100px;
  margin: 0 auto 30px auto;
}
.checkbox__container {
  display: block;
  position: relative;
  height: 42px;
  cursor: pointer;
}
.checkbox__toggle {
  display: none;
}
.checkbox__toggle:checked + .checkbox__checker {
  left: calc(100% - 43px);
  transform: rotateZ(360deg);
}
.checkbox__checker, .checkbox__cross, .checkbox__ok {
  display: block;
  position: absolute;
  height: 43px;
  width: 43px;
  top: -1px;
  left: 0px;
  z-index: 1;
}
.checkbox__checker {
  border-radius: 50%;
  background-color: #fff;
  box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.5);
  transition: 0.3s;
  z-index: 2;
}
.checkbox__checker:before, .checkbox__checker:after {
  transition-duration: 0.3s;
}
.checkbox__cross:before, .checkbox__cross:after, .checkbox__ok:before, .checkbox__ok:after {
  background-color: #ddd;
}
.checkbox__ok {
  left: calc(100% - 43px);
}
.checkbox__txt-left, .checkbox__txt-right {
  display: block;
  position: absolute;
  width: 42px;
  top: 12px;
  text-align: center;
  color: #fff;
  font-size: 12px;
  z-index: 1;
}
.checkbox__txt-right {
  right: 0px;
}
.checkbox__bg {
  position: absolute;
  top: 0;
  left: 0;
  fill: #aaa;
  width: 100%;
  height: 100%;
}

Related Snippets

Leave a comment

Your email address will not be published. Required fields are marked *