/* the overall container of the toggle */ .toggle { display: inline-block; } /* hide the actual checkbox */ .toggle input { display: none; } /* the background of the toggle's track area */ /* also the track appearance when the toggle is "off" */ .toggle .track { display: inline-block; box-sizing: border-box; width: $toggle-width; height: $toggle-height; border: solid $toggle-border-width $toggle-off-border-color; border-radius: $toggle-border-radius; background-color: $toggle-off-bg-color; cursor: pointer; transition-property: background-color, border; transition-duration: $toggle-transition-duration; transition-timing-function: ease-in-out; } /* the switch (circle) thats inside the toggle's track area */ /* also the appearance when the switch is "off" */ .toggle .switch { position: absolute; display: block; width: $toggle-switch-width; height: $toggle-switch-height; border-radius: $toggle-switch-radius; background-color: $toggle-switch-off-bg-color; transition: -webkit-transform $toggle-transition-duration ease-in-out; } /* When the toggle is "on" */ .toggle :checked + .track { /* the track when the toggle is "on" */ border-color: $toggle-on-border-color; background-color: $toggle-on-bg-color; /* the switch when the toggle is "on" */ .switch { background-color: $toggle-switch-on-bg-color; -webkit-transform: translate3d( $toggle-width - $toggle-switch-width - ($toggle-border-width * 2) ,0,0); } }