Skip to content

Instantly share code, notes, and snippets.

@gavinengel
Forked from chriscoyier/dabblet.css
Created November 14, 2013 20:58
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 gavinengel/7474206 to your computer and use it in GitHub Desktop.
Save gavinengel/7474206 to your computer and use it in GitHub Desktop.
Checkbox Hack
/* Checkbox Hack */
input[type=checkbox] {
display: none;
}
label {
display: inline-block;
margin: 60px 0 10px 0;
cursor: pointer;
}
/* Default State */
div {
background: green;
width: 400px;
height: 100px;
line-height: 100px;
color: white;
text-align: center;
}
/* Toggled State */
input[type=checkbox]:checked ~ div {
background: red;
height: 200px;
}
<label for="toggle-1">I'm a toggle</label>
<input type="checkbox" id="toggle-1" />
<div>I'm controlled by toggle. No JavaScript!</div>
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment