Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created February 3, 2019 19:30
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 LeaVerou/80f17f83f3acd7a9c406f15ed0d7af30 to your computer and use it in GitHub Desktop.
Save LeaVerou/80f17f83f3acd7a9c406f15ed0d7af30 to your computer and use it in GitHub Desktop.
Checkbox hack with display: none?
/**
* Checkbox hack with display: none?
*/
input { display: none }
label { display: inline-block; background: yellow; font: bold 300% sans-serif; }
input:checked + label { background: indianred; }
<input type=checkbox id=a />
<label for=a tabindex=0>A</label>
<input type=checkbox id=b />
<label for=b tabindex=0>B</label>
// alert('Hello world!');
{"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