Skip to content

Instantly share code, notes, and snippets.

@ErikBoesen
Created July 14, 2015 16:28
Show Gist options
  • Save ErikBoesen/30fd46ad9d50ba978a52 to your computer and use it in GitHub Desktop.
Save ErikBoesen/30fd46ad9d50ba978a52 to your computer and use it in GitHub Desktop.
.button {
position: absolute;
margin-left: -9999px;
visibility: hidden;
}
.button + label {
display: block;
position: relative;
cursor: pointer;
outline: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
input.button + label {
padding: 2px;
width: 120px;
height: 60px;
}
input.button + label:before, input.button + label:after {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
color: #fff;
font-size: 20px;
text-align: center;
line-height: 60px;
}
input.button + label:before {
background-color: #ddd;
content: attr(data-off);
transition: transform 0.5s;
backface-visibility: hidden;
}
input.button + label:after {
background-color: #8ce196;
content: attr(data-on);
transition: transform 0.5s;
transform: rotateY(180deg);
backface-visibility: hidden;
}
input.button:checked + label:before {
transform: rotateY(180deg);
}
input.button:checked + label:after {
transform: rotateY(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment