
Creative Hamburger Icon Animations
Before We Start to Creative Hamburger Icon Animations
Creative Hamburger Icon Animations can be used to animate a Cards, Buttons, etc. and create user attractive UI components.
So if you are a person who wishes to develop a website, you have to know how to create animations properly. Check out our tutorial and you can learn this techniques and use it on your web development. Below sections shows how to develop this animations.
How to create? We are here to solve your problem. In this article we discuss how to create a hover effect animations. Before we start please read the below articles which easier you to understand the process, if you are new to development.
Step 1 – Add HTML
It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag as below.
<div class="container">
<h2 style="text-align: center;padding: 70px 0 0;">Creative Hamburger Icon Animations</h2>
<div class="menu-toggle first">
<i></i>
</div>
<div class="menu-toggle second">
<i></i>
<i></i>
</div>
</div>
Step 2 – Add CSS
Copy and paste below code in your HTML editor between <style></style> tag as below.
<style>
* {
margin: 0;
padding: 0;
}
.menu-toggle {
height: 32px;
position: relative;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-transition: 0.5s ease-in-out;
-moz-transition: 0.5s ease-in-out;
-o-transition: 0.5s ease-in-out;
transition: 0.5s ease-in-out;
cursor: pointer;
margin: 90px auto;
width: 40px;
}
.menu-toggle:hover {
color: #126911;
}
.menu-toggle i,
.menu-toggle i:after,
.menu-toggle i:before {
display: block;
position: absolute;
height: 3px;
width: 40px;
right: 0;
background: #126911;
border-radius: 2px;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-transition: 0.25s ease-in-out;
-moz-transition: 0.25s ease-in-out;
-o-transition: 0.25s ease-in-out;
transition: 0.25s ease-in-out;
}
.menu-toggle i:after,
.menu-toggle i:before {
content: "";
}
.menu-toggle i:after {
top: -32px;
}
.menu-toggle i:before {
top: -16px;
}
.menu-toggle i {
top: 32px;
}
.menu-toggle.open i:after {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
top: -22px;
}
.menu-toggle.open i:before {
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
top: -22px;
}
.menu-toggle.second i,
.menu-toggle.second i:after,
.menu-toggle.second i:before {
width: 40px;
border-radius: 0px;
}
.menu-toggle.second i:nth-child(1):after {
top: 14px;
}
.menu-toggle.second i:nth-child(1):before {
top: -14px;
}
.menu-toggle.second i:nth-child(1) {
top: 14px;
right: 0;
}
.menu-toggle.second i:nth-child(2):after {
top: 14px;
}
.menu-toggle.second i:nth-child(2):before {
top: 14px;
}
.menu-toggle.second i:nth-child(2) {
top: 14px;
}
.menu-toggle.second.open i:nth-child(1) {
right: 25px;
}
.menu-toggle.second.open i:nth-child(2) {
right: -25px;
}
.menu-toggle.second.open i:before {
top: 0px;
}
.menu-toggle.second.open i:after {
top: 0px;
}
.menu-toggle.second.open i:nth-child(1):before {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
right: -25px;
}
.menu-toggle.second.open i:nth-child(1):after {
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
right: -25px;
}
.menu-toggle.second.open i:nth-child(2):after {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
right: 25px;
}
.menu-toggle.second.open i:nth-child(2):before {
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
right: 25px;
}
/* demo stuff */
body {
background-color: #f7f5ef;
}
html,
button,
input,
select,
textarea {
font-family: "Source Sans Pro", Helvetica, sans-serif;
color: #e8b935;
}
h1 {
text-align: center;
margin: 30px 15px;
}
.link-container {
text-align: center;
}
a.more-link {
font-family: "Source Sans Pro", Helvetica, sans-serif;
background-color: #e8b935;
padding: 2px 10px;
border-radius: 4px;
color: #fff;
display: inline-block;
margin-right: 5px;
margin-bottom: 5px;
line-height: 1.5;
text-decoration: none;
}
</style>
At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.
Step 3 – Add JavaScript
We use some external JS to this code. No need to worry about this, copy and paste below code to the bottom of <body></body> tag. Before </body> closing tag.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/jquery-3.7.1.js"></script>
Copy and paste below code in your HTML editor between <script></script> tag.
<script>
$(document).ready(function() {
$(".menu-toggle").click(function() {
$(this).toggleClass("open");
});
});
</script>
Out Put


Video Tutorial
Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.
Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.