mercredi 1 juillet 2020

styling CSS checkbox [closed]

Currently my checkbox is a toggle switch but I must change it to looking more like the picture.enter image description here

Here is my code for the toggle switch checkbox..

input[type='checkbox'] {
    position: relative;
    margin-right: 15px;
    cursor: pointer;
    width: 45px;
    height: 20px;
    -webkit-appearance: none;
    background: #c6c6c6;
    outline: none;
    border-radius: 20px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    transition: 0.5s;
  }
  input:checked[type='checkbox'] {
    background-color: #002169;
  }
  input[type='checkbox']:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-radius: 20px;
    background-color: #fff;
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: 0.5s;
  }
  input:checked[type='checkbox']:before {
    left: 25px;
  }
<input type="checkbox" checked> Blah<br>
<input type="checkbox" > Blah<br>

Any help with the new styling will be much appreciated. Thank you




Aucun commentaire:

Enregistrer un commentaire