Last active
April 30, 2018 13:42
-
-
Save Loupax/f57b3f7fe48f3514903939ab7356bb67 to your computer and use it in GitHub Desktop.
Use a hidden checkbox, label and styles to style the checkbox. A fork (and minor clean up) of https://gist.github.com/592332
This file contains hidden or 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 lang="en-US"> | |
<head> | |
<title>Checkbox</title> | |
<style> | |
input[type=checkbox] { | |
display:none; | |
} | |
input[type=checkbox] + label { | |
background: url('http://dl.dropbox.com/u/11180/icons/unchecked.png') no-repeat; | |
height: 30px; | |
width: 30px; | |
display: block; | |
padding: 0; | |
} | |
input[type=checkbox]:checked + label { | |
background: url('http://dl.dropbox.com/u/11180/icons/checked.png') no-repeat; | |
height:30px; | |
width: 30px; | |
display: block; | |
padding: 0; | |
} | |
</style> | |
</head> | |
<body> | |
<p> | |
<input type="checkbox" name="thing" value="valuable" id="thing"/> | |
<label for="thing"></label> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment