Pure CSS3 Metal Checkbox
HTML
<span class="checkbox">
<input type="checkbox">
<label data-on="ON" data-off="OFF"></label>
</span>
CSS
.checkbox {
display:inline-block;
position:relative;
text-align:left;
width:60px;
height:30px;
background-color:#222;
overflow:hidden;
-webkit-box-shadow:inset 0 1px 2px black,0 1px 0 rgba(255,255,255,0.1);
-moz-box-shadow:inset 0 1px 2px black,0 1px 0 rgba(255,255,255,0.1);
box-shadow:inset 0 1px 2px black,0 1px 0 rgba(255,255,255,0.1);
-webkit-border-radius:6px;
-moz-border-radius:6px;
border-radius:6px;
}
.checkbox input {
display:block;
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
width:100%;
height:100%;
margin:0 0;
cursor:pointer;
opacity:0;
filter:alpha(opacity=0);
z-index:2;
}
.checkbox label {
background-color:#3c3c3c;
background-image:-webkit-linear-gradient(-40deg,rgba(0,0,0,0),rgba(255,255,255,0.1),rgba(0,0,0,0.2));
background-image:-moz-linear-gradient(-40deg,rgba(0,0,0,0),rgba(255,255,255,0.1),rgba(0,0,0,0.2));
background-image:-ms-linear-gradient(-40deg,rgba(0,0,0,0),rgba(255,255,255,0.1),rgba(0,0,0,0.2));
background-image:-o-linear-gradient(-40deg,rgba(0,0,0,0),rgba(255,255,255,0.1),rgba(0,0,0,0.2));
background-image:linear-gradient(-40deg,rgba(0,0,0,0),rgba(255,255,255,0.1),rgba(0,0,0,0.2));
-webkit-box-shadow:0 0 0 1px rgba(0,0,0,0.1),0 1px 2px rgba(0,0,0,0.7);
-moz-box-shadow:0 0 0 1px rgba(0,0,0,0.1),0 1px 2px rgba(0,0,0,0.7);
box-shadow:0 0 0 1px rgba(0,0,0,0.1),0 1px 2px rgba(0,0,0,0.7);
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
display:inline-block;
width:40px;
text-align:center;
font:bold 11px/28px Arial,Sans-Serif;
color:#999;
text-shadow:0 -1px 0 rgba(0,0,0,0.7);
-webkit-transition:margin-left 0.2s ease-in-out;
-moz-transition:margin-left 0.2s ease-in-out;
-ms-transition:margin-left 0.2s ease-in-out;
-o-transition:margin-left 0.2s ease-in-out;
transition:margin-left 0.2s ease-in-out;
margin:1px;
}
.checkbox label:before {
content:attr(data-off);
}
.checkbox input:checked + label {
margin-left:19px;
background-color:#034B78;
color:white;
}
.checkbox input:checked + label:before {
content:attr(data-on);
}
Demo
Labels: CSS, Desain, Eksperimen
9 Comments:
pertama coment ane ya, kunjung balik gan, di blog jelek aku.
By debbie irlando manurung, at Wednesday, July 18, 2012 at 2:46:00 AM GMT+7
rajin bener bos!!!
http://proto.io/freebies/onoff/
:D
By Beben Koben, at Wednesday, July 18, 2012 at 8:12:00 PM GMT+7
Meski generatornya bagus, tapi untuk elemen-elemen UI sekelas checkbox, Saya rasa markupnya terlalu banyak ya? :\
By Taufik Nurrohman, at Wednesday, July 18, 2012 at 9:12:00 PM GMT+7
biar validasi gitoo loh...wekekekkk
kreasi orang ini :D
By Beben Koben, at Wednesday, July 18, 2012 at 10:43:00 PM GMT+7
Setiap orang bebas berpendapat(an) =D
By Taufik Nurrohman, at Wednesday, July 18, 2012 at 11:34:00 PM GMT+7
Bikin bgitu hanya dengan CSS?? Salut deh!!
By Wak, at Saturday, October 13, 2012 at 2:26:00 PM GMT+7
Umm.. Kok Gagalya ? Apa pakay jquery :(
By Unknown, at Thursday, January 31, 2013 at 10:57:00 AM GMT+7
maaf ane awam soal ginian, fungsinay buat aa ya?
By ricology, at Thursday, June 20, 2013 at 12:31:00 AM GMT+7
gak pakai javascript yg ini?
By Unknown, at Saturday, November 2, 2013 at 1:26:00 PM GMT+7
Post a Comment
<< Home