Skip to content

Instantly share code, notes, and snippets.

@robertmagnusson
Created February 25, 2014 09:25
Show Gist options
  • Save robertmagnusson/9205629 to your computer and use it in GitHub Desktop.
Save robertmagnusson/9205629 to your computer and use it in GitHub Desktop.
Open menu button - Pure css
.button span {
position: absolute;
z-index: 999;
top: 50%;
right: 0;
display: block;
width: 30px;
height: 4px;
margin-top: -2px;
background-color: #fff;
font-size: 0px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transition: background-color 0.3s;
transition: background-color 0.3s;
}
.open-menu .button span {
background-color: transparent;
}
.button span:before,
.button span:after {
position: absolute;
left: 0;
width: 100%;
height: 100%;
background: #fff;
content: '';
-webkit-transition: -webkit-transform 0.3s;
transition: transform 0.3s;
}
.button span:before {
-webkit-transform: translateY(-250%);
transform: translateY(-250%);
}
.button span:after {
-webkit-transform: translateY(250%);
transform: translateY(250%);
}
.open-menu .button span:before {
-webkit-transform: translateY(0) rotate(45deg);
transform: translateY(0) rotate(45deg);
}
.open-menu .button span:after {
-webkit-transform: translateY(0) rotate(-45deg);
transform: translateY(0) rotate(-45deg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment