Skip to content

Instantly share code, notes, and snippets.

@jcubic
Created November 22, 2016 14:31
Show Gist options
  • Save jcubic/cdc4be5e8d201a714bd18de9c86aac9f to your computer and use it in GitHub Desktop.
Save jcubic/cdc4be5e8d201a714bd18de9c86aac9f to your computer and use it in GitHub Desktop.
Untitled
.toggle-switch {
display: inline-block;
position: relative;
border-radius: 20px;
background-color: #E6E6E6;
padding: 10px;
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select: none;
}
.toggle-switch input {
display: none;
}
.toggle-switch label {
font-family: sans-serif;
text-transform: uppercase;
font-size: 14px;
font-weight: bold;
position: relative;
}
.toggle-switch label:before {
content: "";
display: block;
position: absolute;
z-index: 50;
background-color: white;
width: 100px;
height: 100%;
padding: 10px;
top: -10px;
left: -10px;
right: auto;
border-radius: 20px;
transition: all 0.2s linear;
box-shadow: 0px 1px 5px gray;
}
.toggle-switch input:checked + label:before {
left: 100%;
margin-left: -111px
}
.toggle-switch span {
display: inline-block;
width: 100px;
text-align: center;
position: relative;
z-index: 100;
}
.toggle-switch .toggle-switch-off {
color: #0066CC;
}
<div class="toggle-switch">
<input type="checkbox" id="toggle-switch-01"/>
<label for="toggle-switch-01">
<span class="toggle-switch-on">Edit</span>
<span class="toggle-switch-off">Preview</span>
</label>
</div>
// alert('Hello world!');
{"view":"split","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