<div class="container">
<div class="menu_icon">
<span class="one"></span>
<span class="two"></span>
<span class="three"></span>
</label>
</div>
</div>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.container {
height: 100vh;
width: 100vw;
overflow: hidden;
background: #485563;
background: -webkit-linear-gradient(to right, #29323c, #485563);
background: linear-gradient(to right, #29323c, #485563);
display: flex;
justify-content: center;
align-items: center;
}
.menu_icon {
width: 55px;
height: 55px;
margin: auto;
z-index: 10;
cursor: pointer;
position: relative;
display: flex;
align-items: center;
padding: 5px 0;
}
.menu_icon span {
position: absolute;
display: block;
height: 5px;
width: 60px;
background-color: #fff;
transform: rotate(0);
transition: all 300ms cubic-bezier(1, 0, 0, 1);
}
span.one {
top: 0px;
}
span.two {
top: 25px;
}
span.three {
top: 50px;
}
.clicked .one {
transform: translateY(25px) rotate(45deg);
width: 70px;
}
.clicked .two {
transform: translateY(-60vh);
opacity: 0;
width: 70px;
}
.clicked .three {
transform: translateY(-25px) rotate(-45deg);
width: 70px;
}
let icon = document.querySelector(".menu_icon");
icon.addEventListener("click", () => {
icon.classList.toggle("clicked");
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.