Skip to content

Instantly share code, notes, and snippets.

@Raminsiach
Created December 18, 2015 10:45
Show Gist options
  • Save Raminsiach/e66de1d8196cfab58d3c to your computer and use it in GitHub Desktop.
Save Raminsiach/e66de1d8196cfab58d3c to your computer and use it in GitHub Desktop.

Revisions

  1. Raminsiach created this gist Dec 18, 2015.
    47 changes: 47 additions & 0 deletions toggleswitch.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    <!DOCTYPE html>
    <html>
    <head>
    <title>Toggle Switch</title>
    <style>
    .switch {
    position: relative;
    }
    .switch label {
    width: 55px;
    height: 23px;
    position: absolute;
    background-color: #999;
    top: 0;
    left: 0;
    border-radius: 50px;
    }
    .switch input[type="checkbox"] {
    visibility: hidden;
    }
    .switch label:after {
    content: '';
    width: 21px;
    height: 21px;
    border-radius: 50px;
    position: absolute;
    top: 1px;
    left: 1px;
    transition: all 0.1s;
    background-color: white;
    }
    .switch input[type="checkbox"]:checked + label:after {
    left: 33px;
    }
    .switch input[type="checkbox"]:checked + label {
    background-color: green;
    }

    </style>
    </head>
    <body>
    <div class="switch">
    <input type="checkbox" id="checkbox1">
    <label for="checkbox1"></label>
    </div>
    </body>
    </html>