Untitled

mail@pastecode.io avatar
unknown
html
a year ago
1.0 kB
1
Indexable
Never
<div class="checkbox-wrapper-17">
  <input type="checkbox" id="switch-17" /><label for="switch-17"></label>
</div>

<style>
  .checkbox-wrapper-17 input[type=checkbox] {
    height: 0;
    width: 0;
    visibility: hidden;
  }

  .checkbox-wrapper-17 label {
    --size: 50px;

    cursor: pointer;
    width: var(--size);
    height: calc(var(--size) / 2);
    background: grey;
    display: block;
    border-radius: 100px;
    position: relative;
  }

  .checkbox-wrapper-17 label:after {
    content: '';
    position: absolute;
    top: 6%;
    left: 2.5%;
    width: calc(50% - 5%);
    height: calc(100% - 11%);
    background: #fff;
    border-radius: 90px;
    transition: 0.3s;
  }

  .checkbox-wrapper-17 input:checked + label {
    background: #bada55;
  }

  .checkbox-wrapper-17 input:checked + label:after {
    left: calc(100% - 2.5%);
    transform: translateX(-100%);
  }

  .checkbox-wrapper-17 label:active:after {
    width: 55%;
  }
</style>