Last active
August 29, 2015 14:04
-
-
Save cchana/0f8f42199d913c83d92f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Faux checkboxes and radio buttons</title> | |
<link type="text/css" rel="stylesheet" href="style.css" /> | |
</head> | |
<body> | |
<ul> | |
<li><label for="checkbox1">Check me</label><input type="checkbox" id="checkbox1" name="checkbox1" /></li> | |
<li><label for="checkbox2">And me</label><input type="checkbox" id="checkbox2" name="checkbox2" /></li> | |
<li class="hr"></li> | |
<li><label for="radio1">Pick me</label><input type="radio" id="radio1" name="radio[]" /></li> | |
<li><label for="radio2">Or me</label><input type="radio" id="radio2" name="radio[]" /></li> | |
</ul> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ul { | |
list-style-type: none; | |
margin: 0; | |
padding: 0; | |
} | |
li { | |
margin: 5px 0; | |
padding: 0; | |
position: relative; | |
} | |
li.hr { | |
background-color: #BBB; | |
height: 1px; | |
} | |
label { | |
display: inline-block; | |
width: 100px; | |
} | |
input[type="checkbox"], | |
input[type="radio"] { | |
visibility: hidden; | |
} | |
input[type="checkbox"]:before, | |
input[type="radio"]:before { | |
background-color: #DDD; | |
border: 1px solid #BBB; | |
box-shadow: 0 0 5px rgba(0,0,0,0.15); | |
content: ''; | |
display: block; | |
height: 20px; | |
position: absolute; | |
top: -2px; | |
visibility: visible; | |
width: 20px; | |
transition: background-color 0.5s, border-color 0.5s; | |
-moz-transition: background-color 0.5s, border-color 0.5s; | |
-webkit-transition: background-color 0.5s, border-color 0.5s; | |
} | |
input[type="checkbox"]:before { | |
border-radius: 3px; | |
} | |
input[type="radio"]:before { | |
border-radius: 10px; | |
} | |
input[type="checkbox"]:checked:before, | |
input[type="radio"]:checked:before { | |
border-color: #888; | |
} | |
input[type="checkbox"]:checked:before { | |
background-color: #5D5; | |
} | |
input[type="radio"]:checked:before { | |
background-color: #5D5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment