CSS Slider Switch

Slider on/off switch using CSS.

by Frank Liu

HTML

<div>
<span class="text">add0000</span>
<label class="ist-sliderLabel">
    <span class="inner-text">add</span>
    <input type="checkbox" />
    <span class="ist-slider"></span>
    <span class="ist-sliderOn">Single</span>
    <span class="ist-sliderOff">Bulk</span>
</label>
</div>

CSS

div{
  float:left;
}

.ist-sliderLabel {
    border: 1px solid #b8b8b8;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    cursor: pointer;
    display: inline-block;
    height: 30px;
    width: 130px;
     
    overflow: hidden;
    position: relative;
    border: 1px solid red;
 
}
.text {
    /*margin-right: 20px;*/
    color:black;
}

.ist-sliderLabel input {
    display: none;
}
.ist-sliderLabel input:checked + .ist-slider {
    left: 0px;
}
.ist-slider {
    background: -webkit-linear-gradient(top, #eee 0%,#aaa 100%);
    -moz-border-radius: 3px;
    display: block;
    height: 30px;
    left: -4px;
    position: absolute;
    top: 0px;
    left:65px;
    -moz-transition: left .25s ease-out;
    -webkit-transition: left .25s ease-out;
    transition: left .25s ease-out;
    width: 69px;
    z-index: 1;
}
.ist-sliderOn, .ist-sliderOff {
    color: white;
    display: block;
    font-family: "Segoe UI", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 30px;
    position: absolute;
    text-align: center;
    top: 0px;
    width: 65px;
}
.ist-sliderOn {
    background: linear-gradient(to bottom, #0F9EE0 30%, #0078CF 70%);
    left: 0px;
}
.ist-sliderOff {
    background: linear-gradient(to bottom, #0F9EE0 30%, #0078CF 70%);
    right: 0px;
}