Skip to content

Instantly share code, notes, and snippets.

@vinoddalvi
Forked from chriscoyier/dabblet.css
Created June 9, 2014 13:40
Show Gist options
  • Save vinoddalvi/8a533cf79b1aba36b0d9 to your computer and use it in GitHub Desktop.
Save vinoddalvi/8a533cf79b1aba36b0d9 to your computer and use it in GitHub Desktop.
Checkbox Hack
/* Checkbox Hack */
input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
}
label {
-webkit-appearance: push-button;
-moz-appearance: button;
display: inline-block;
margin: 60px 0 10px 0;
cursor: pointer;
}
/* Default State */
div {
display:none;
background: green;
width: 400px;
height: 100px;
line-height: 100px;
color: white;
text-align: center;
}
/* Toggled State */
input[type=checkbox]:checked ~ div {
display:block;
}
<label for="toggle-1">Click</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":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment