CSS iPhone Style Checkbox
Another way to make checkboxes more interesting.
by muthusamy
HTML
<p><a href="http://awardwinningfjords.com/2009/06/16/iphone-style-checkboxes.html">Inspired by this jQuery based solution.</a></p>
<label id="sliderLabel">
<input type="checkbox" />
<span id="slider">
<span id="sliderOn">SELECTED</span>
<span id="sliderOff">SELECT</span>
<span id="sliderBlock"></span>
</span>
</label>
CSS
p {
margin: 10px;
}
#sliderLabel {
border: 1px solid #a2a2a2;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
cursor: pointer;
display: block;
height: 30px;
margin: 20px auto;
overflow: hidden;
position: relative;
width: 200px;
}
#sliderLabel input {
display: none;
}
#sliderLabel input:checked + #slider {
left: 110px;
}
#slider {
left: -50px;
position: absolute;;
top: 0px;
-moz-transition: left .25s ease-out;
-webkit-transition: left .25s ease-out;
-o-transition: left .25s ease-out;
transition: left .25s ease-out;
}
#sliderOn, #sliderBlock, #sliderOff {
display: block;
font-family: arial, verdana, sans-serif;
font-weight: bold;
height: 30px;
line-height: 30px;
position: absolute;
text-align: center;
top: 0px;
}
#sliderOn {
background: #3269aa;
background: -moz-linear-gradient(top, #3269aa 0%, #82b3f4 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3269aa), color-stop(100%,#82b3f4));
background: -webkit-linear-gradient(top, #3269aa 0%,#82b3f4 100%);
background: -o-linear-gradient(top, #3269aa 0%,#82b3f4 100%);
background: -ms-linear-gradient(top, #3269aa 0%,#82b3f4 100%);
background: linear-gradient(top, #3269aa 0%,#82b3f4 100%);
color: white;
left: -110px;
width: 164px;
}
#sliderBlock {
background: #d9d9d8;
background: -moz-linear-gradient(top, #d9d9d8 0%, #fcfcfc 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d9d9d8), color-stop(100%,#fcfcfc));
background: -webkit-linear-gradient(top, #d9d9d8 0%,#fcfcfc 100%);
background: -o-linear-gradient(top, #d9d9d8 0%,#fcfcfc 100%);
background: -ms-linear-gradient(top, #d9d9d8 0%,#fcfcfc 100%);
background: linear-gradient(top, #d9d9d8 0%,#fcfcfc 100%);
border: 1px solid #a2a2a2;
-moz-border-radius: 3px;
...