Created
December 18, 2015 10:42
-
-
Save Raminsiach/69011f1f751fb0c43f66 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>CSS3 Checkbox</title> | |
<style type="text/css"> | |
.checkbox { | |
width: 30px; | |
height: 30px; | |
background-color: #ddd; | |
position: relative; | |
} | |
.checkbox input[type="checkbox"] { | |
visibility: hidden; | |
} | |
.checkbox label { | |
width: 28px; | |
height: 28px; | |
position: absolute; | |
top: 1px; | |
left: 1px; | |
background-color: white; | |
cursor: pointer; | |
} | |
.checkbox label:before { | |
content: ''; | |
width: 9px; | |
height: 5px; | |
border: 3px solid white; | |
position: absolute; | |
border-top: none; | |
border-right: none; | |
transform: rotate(-45deg); | |
top: 8px; | |
left: 8px; | |
opacity: 0; | |
} | |
.checkbox input[type="checkbox"]:checked + label:before { | |
opacity: 1; | |
} | |
.checkbox input[type="checkbox"]:checked + label { | |
background-color: #57bba7; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="checkbox"> | |
<input type="checkbox" id="checkbox1"> | |
<label for="checkbox1"></label> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment