Skip to content

Instantly share code, notes, and snippets.

@chriskavanagh
Last active November 10, 2019 05:55
Show Gist options
  • Save chriskavanagh/218b50020d8ea618fcf49c4ab4ce9408 to your computer and use it in GitHub Desktop.
Save chriskavanagh/218b50020d8ea618fcf49c4ab4ce9408 to your computer and use it in GitHub Desktop.
Hamburger Button HTML/CSS
<div class="nav-icon">
<div></div>
</div>
https://codepen.io/chriskavanagh/pen/zYYjZGq
.nav-icon {
margin: 1em;
width: 40px;
}
.nav-icon::after,
.nav-icon::before,
.nav-icon div {
background-color: red;
border-radius: 3px;
content: '';
display: block;
height: 5px;
margin: 7px 0;
transition: all .2s ease-in-out;
}
.nav-icon:hover::before {
transform: translateY(12px) rotate(135deg);
}
.nav-icon:hover::after {
transform: translateY(-12px) rotate(-135deg);
}
.nav-icon:hover div {
transform: scale(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment