Skip to content

Instantly share code, notes, and snippets.

@heroheman
Created April 8, 2013 12:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heroheman/5336455 to your computer and use it in GitHub Desktop.
Save heroheman/5336455 to your computer and use it in GitHub Desktop.
SCSS: IOS Checkbox Switch
$speed : 0.1s;
.switchButton input {
// Knopf
&::after {
content: '';
margin: 0;
padding: 0;
width: 25px;
height: 25px;
background: -webkit-linear-gradient(top, #cdcdcd, #fbfbfb);
border-radius: 50%;
box-shadow: inset 0 1px 0 #f0f0f0;
position: absolute;
top: 0;
left: 32px;
border: 1px solid #919191;
// -webkit-transition: $speed all linear;
}
// Active
&::before {
content: 'An';
margin: 0;
padding: 0;
width: 40px;
height: 25px;
background: -webkit-linear-gradient(top, #365b75, #1b4360);
border-radius: 10px 0 0 10px;
border: 1px solid #1b4360;
box-shadow: inset 0 2px 2px #1b4360, inset -3px 0 3px #1b4360;
text-align: center;
color: #fff;
font: 700 14px sans-serif;
text-shadow: 0 -1px 0 #1b3b6f;
line-height: 27px;
position: absolute;
top: 0;
left: 0;
}
-webkit-appearance: none;
margin: 10px auto;
padding: 0;
display: block;
width: 94px;
height: 27px;
position: relative;
// -webkit-transition: $speed all linear;
&:checked {
&::after {
left: 0px;
}
// Inactive
&::before {
content: 'Aus';
left: 18px;
border-radius: 0 10px 10px 0;
background: -webkit-linear-gradient(top, #cfcfcf, #efefef 50%, #f9f9f9 50%, #fefefe);
box-shadow: inset 0 2px 2px #b6b6b6, inset 3px 0 3px #b6b6b6;
color: #7f7f7f;
text-shadow: none;
border-color: #7d7d7d;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment