-
-
Save gersteba/2afc1a1c59bda8e73cb56c14d2983cf4 to your computer and use it in GitHub Desktop.
Checkbox Hack
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 */ | |
input[type=checkbox] { | |
position: absolute; | |
top: -9999px; | |
left: -9999px; | |
} | |
label { | |
display: inline-block; | |
margin: 60px 0 10px 0; | |
cursor: pointer; | |
border: 2px solid transparent; | |
} | |
input[type=checkbox]:checked ~ label { | |
border-color: red; | |
margin-bottom: 60px; | |
} | |
/* Default State */ | |
div { | |
width: 400px; | |
height: 100px; | |
line-height: 100px; | |
color: white; | |
text-align: center; | |
} | |
div.first { | |
background: red; | |
} | |
div.second{ | |
background: green; | |
} | |
/* Toggled State */ | |
input[type=checkbox]:checked ~ div.first { | |
background: green; | |
} | |
input[type=checkbox]:checked ~ div.second { | |
background: red; | |
} |
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="toggle-1"> | |
<label for="toggle-1">I'm a toggle</label> | |
<div class="first">I'm controlled by toggle. No JavaScript!</div> | |
<div class="second">I'm controlled by toggle. No JavaScript!</div> |
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-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment