Skip to content

Instantly share code, notes, and snippets.

@exarcheia-web
Created December 17, 2013 19:07
Show Gist options
  • Save exarcheia-web/8010781 to your computer and use it in GitHub Desktop.
Save exarcheia-web/8010781 to your computer and use it in GitHub Desktop.
Checkbox hack
/* Checkbox hack */
.click-me {
background: gainsboro;
padding: 15px 20px;
display: block;
width: 80px;
text-align: center;
margin: 10px auto;
}
.click-me:hover {
cursor: pointer;
background: hotpink;
}
.change-me {
background: aliceblue;
border: 1px solid black;
color: navy;
width: 120px;
height: 120px;
line-height: 120px;
border-radius: 50%;
text-align: center;
margin: auto;
transition: .4s all;
}
/* hide the input */
#checkbox {
position: absolute;
top: -9999em;
left: -9999em;
}
#checkbox:checked ~ .change-me {
box-shadow: 0 0 18px navy;
}
<label for="checkbox" class="click-me">Click me</label>
<input type="checkbox" id="checkbox">
<div class="change-me">Change me</div>
// alert('Hello world!');
{"view":"split","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