Created
February 3, 2019 19:30
-
-
Save LeaVerou/80f17f83f3acd7a9c406f15ed0d7af30 to your computer and use it in GitHub Desktop.
Checkbox hack with display: none?
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
/** | |
* Checkbox hack with display: none? | |
*/ | |
input { display: none } | |
label { display: inline-block; background: yellow; font: bold 300% sans-serif; } | |
input:checked + label { background: indianred; } |
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
<input type=checkbox id=a /> | |
<label for=a tabindex=0>A</label> | |
<input type=checkbox id=b /> | |
<label for=b tabindex=0>B</label> |
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
// alert('Hello world!'); |
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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment