Skip to content

Instantly share code, notes, and snippets.

@yukulele
Created September 18, 2012 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yukulele/3743234 to your computer and use it in GitHub Desktop.
Save yukulele/3743234 to your computer and use it in GitHub Desktop.
CSS3 checkbox
/* CSS3 checkbox */
/* don't works on firefox :-( */
input[type=checkbox]{
position:relative;
display:inline-block;
width : 40px;
height : 40px;
font-size: 40px;
background:#009;
visibility:hidden;
line-height:1;
text-align:center;
vertical-align:top;
margin:0;
padding:0;
left:0;
right:100%;
transition:right .4s ease;
}
input[type=checkbox]:checked{
right:0;
}
input[type=checkbox]:before{
content:'☑';
display:block;
position:absolute;
top:0;
left:0;
right:inherit;
overflow:hidden;
bottom:0;
visibility:visible;
}
input[type=checkbox]:after{
content:'☐';
display:block;
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
background:rgba(0,0,0,.1);
visibility:visible;
}
input[type=checkbox]:checked:before{
width:1;
}
<input type="checkbox">
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment