Animated Hamburger Menu using HTML CSS (Free Code)

Animated Hamburger Menu using HTML CSS

In this article, you will learn how to create Animated Hamburger Menu using HTML and CSS. Hamburger Menu CSS We use it in different places. Earlier I shared a tutorial on making more hamburger icons. However, I have added animation to this design.

In this article, you will learn how to create an Animated Hamburger Menu CSS. Here I have used a small amount (only two lines) of JavaScript. The most common type of hamburger icon is found in different types of site menubars, navigation menu bars.

Animated Hamburger Menu CSS

Here you will find the required source code, tutorials, and previews. Below I have given a preview of this project and you can see how it works.

See the Pen
Untitled
by Foolish Developer (@foolishdevweb)
on CodePen.

 As you can see, a small button has been created at the top of a web page. There are three lines on that button. When you click on that hamburger icon, you will see animation in it. 

Those three lines will be transformed into a circular circle and a cross mark will be seen in the circle. When you click on that button again, the button will be converted to three lines again. The background of the hamburger menu icon has been made blue and the color of the lines has been made white.

How to make an animated hamburger menu

To make it, you must have a basic idea about HTML CSS. Here I have used only 2 lines of JavaScript. However, it is very easy if you do not know JavaScript can easily understand.

Step 1: Basic structure of the Hamburger Menu

Using your bellow HTML and CSS codes, add the necessary information to this menu. I have only used 2 line HTML code here. 

I used blue color in the background of this button and the button is height: 172px, width: 172px.

<div id=”toggle-nav”>
  <div class=”hamburger”></div>
</div>
body {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
#toggle-nav {
 position: relative;
 background: rgb(12, 94, 196);
 height: 172px;
 width: 172px;
 border-radius: 30px;
 cursor: pointer;
}
Basic structure of the Hamburger Menu

Step 2: Add 3 lines to the hamburger menu (more…)

Continue ReadingAnimated Hamburger Menu using HTML CSS (Free Code)