on/off toggle button
by Ayyappan Sakthivadivel
HTML
<label class="switch">
<input type="checkbox" class="switch-input">
<span class="switch-label" data-on="On" data-off="Off"></span>
<span class="switch-handle"></span>
</label>
<audio id="audio" src="http://www.sousound.com/music/healing/healing_01.mp3" preload="auto" ></audio>
CSS
.switch {
display: block;
margin: 12px auto;
position: relative;
display: inline-block;
vertical-align: top;
width: 70px;
height: 30px;
padding: 3px;
background-color: white;
-moz-border-radius: 18px;
-webkit-border-radius: 18px;
border-radius: 18px;
cursor: pointer;
}
.switch-input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.switch-label {
position: relative;
display: block;
height: inherit;
font-size: 10px;
text-transform: uppercase;
background:#bdc3c7;
-moz-border-radius: inherit;
-webkit-border-radius: inherit;
border-radius: inherit;
-webkit-transition: 0.15s ease-out;
-moz-transition: 0.15s ease-out;
-o-transition: 0.15s ease-out;
transition: 0.15s ease-out;
-webkit-transition-property: opacity background border;
-moz-transition-property: opacity background border;
-o-transition-property: opacity background border;
transition-property: opacity background border;
}
.switch-label:before, .switch-label:after {
position: absolute;
top: 50%;
margin-top: -.5em;
line-height: 1;
-webkit-transition: inherit;
-moz-transition: inherit;
-o-transition: inherit;
transition: inherit;
font-size:14px;
}
.switch-label:before {
content: attr(data-off);
right: 11px;
color: #000;
}
.switch-label:after {
content: attr(data-on);
left: 11px;
color: white;
opacity: 0;
}
.switch-input:checked ~ .switch-label {
background: #34495E;
}
.switch-input:checked ~ .switch-label:before {
opacity: 0;
}
.switch-input:checked ~ .switch-label:after {
opacity: 1;
}
.switch-handle {
position: absolute;
top: 9px;
left: 10px;
width: 18px;
height: 18px;
background: white;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
-webkit-transition: left 0.15s ease-out;
-moz-transition: left 0.15s ease-out;
-o-transition: left 0.15s ease-out;
transition: left 0.15s ease-out;
}
.switch-handle:before {
content: '';
position: absolute;
top: 50%;
left: 50%;
margin: -6px 0 0...