Skip to content

Instantly share code, notes, and snippets.

@radmar
Created December 1, 2012 17:58
Show Gist options
  • Select an option

  • Save radmar/4183603 to your computer and use it in GitHub Desktop.

Select an option

Save radmar/4183603 to your computer and use it in GitHub Desktop.
Checkbox alternative UI
/**
* Checkbox alternative UI
*/
.switch-toggle {
display: none;
visibility: hidden;
}
.switch-content {
/*-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
-ms-transition: all 500ms ease-in-out;
-o-transition: all 500ms ease-in-out;*/
transition: all 500ms ease-in-out;
}
.switch {
display: inline-block;
height: 30px;
overflow: hidden;
width: auto;
position: relative;
margin: 0;
cursor: pointer;
line-height: 30px;
}
.switch-content {
height: 200%;
position: relative;
width: auto;
display: inline-block;
color: white
}
.switch-content-checked, .switch-content-unchecked {
/*background: rgba(157, 38, 29, 0.5);*/
cursor: pointer;
display: block;
height: 50%;
width: auto;
text-align: center;
padding: 0 5px;
}
.switch-toggle:checked + .switch > .switch-content { top: 0; background-color: green;}
.switch-toggle + .switch > .switch-content { top: -100%; background-color: red;}
<!-- content to be placed inside <body>…</body> -->
<input type="checkbox" id="check1" class="switch-toggle" />
<label class="switch" for="check1">
<div class="switch-content">
<div class="switch-content-checked">Enabled</div>
<div class="switch-content-unchecked">Disabled</div>
</div>
</label>
// alert('Hello world!');
{"view":"separate","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment