jeudi 6 décembre 2018

How do I make this checkbox styling work in Edge?

I'm styling my checkboxes to look like toggle switches which works beautifully in Chrome, UC Browser, Safari for Windows and is a bit choppy in Firefox but acceptable. Unfortunately in Edge it doesn't work at all.

I've looked through the CSS properties I'm using and it appears as though all are supported by Edge so I don't understand what I'm missing.

.toggle{
      width:34px;
      height:16px;
      border-radius:40px;
      position:relative;
      -webkit-appearance: none;
      margin:2px 0 0 0px;
      box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.4);
      background: -webkit-linear-gradient(#c6c6c6,#e3e3e3);
      cursor:hand;cursor:pointer;pointer:hand;
      outline: 0;
    }
    .toggle:checked{
      background: -webkit-linear-gradient(#77178F,#AD73BB);
      box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.4);
    }
    .toggle:before {
      content:'';
      letter-spacing:1px;
      color: rgba(0,0,0,.15);
      font-size:10px;
      font-weight:100;
      text-shadow:1px 1px 1px rgba(255,255,255,1);
      width:7px;
      height:7px;
      padding:2px;
      top:2px;
      left:2px;
      position:absolute;
      border-radius:40px;
      background: linear-gradient(#ebebeb,#f1f1f1);
      box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.2),
            -1px 1px 2px rgba(0, 0, 0, 0.3),
            inset 1px 1px 1px #ffffff;
      transition: all 0.4s;
    }
    .toggle:checked:before {
      left:20px;
      background:#f1f1f1;
    }
    .toggle:checked:after {
      background: linear-gradient(#d8eec4,#5fa718);
      box-shadow: inset -1px -1px 4px #417f0b,
            inset 1px 1px 2px #5b9f1a;
    }
<input type=checkbox class=toggle>

It looks to me like -webkit-appearance:none is not doing what it's supposed to (hide the original checkbox) but that also is supposedly supported.

If anybody has any experience with this issue and can give me some insight it would be much appreciated.




Aucun commentaire:

Enregistrer un commentaire