Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • CSS Tutorial
  • CSS Exercises
  • CSS Interview Questions
  • CSS Selectors
  • CSS Properties
  • CSS Functions
  • CSS Examples
  • CSS Cheat Sheet
  • CSS Templates
  • CSS Frameworks
  • Bootstrap
  • Tailwind
  • CSS Formatter
Open In App
Next Article:
How to create Vertical Menu using HTML and CSS ?
Next article icon

How to create a Menu Icon using CSS ?

Last Updated : 26 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The Menu Icon is mostly used on smaller screens, there's limited space to display a full navigation menu. A menu icon helps in hiding the navigation items initially and revealing them when the user needs them. In this article, we will see how To Create a Menu Icon using CSS.

There are many ways to create a Menu Icon using CSS. The article contains two ways including a simple menu icon and an animated menu icon.

Table of Content

  • Simple Menu Icon using CSS
  • Animated Menu Icon using CSS

Simple Menu Icon using CSS

In this approach, we will design a simple menu icon with the help of CSS properties by incorporating three horizontal lines and designing it most simply and attractively.

Approach

  • First create the basic structure of the project using different elements including <div>, <h1>, and <h3>.
  • For creating a simple menu icon with three horizontal bars there are three <div> elements defined in the HTML file.
  • Give them styling with different CSS properties like height, margin, width, and background color.
  • At last use other CSS properties like box-shadow and flexbox properties to give a pleasing effect to the menu icon.

Example: The example shows how To Create a Menu Icon using different flexbox properties.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport"            content="width=device-width,                    initial-scale=1.0">     <title>Menu Icon using CSS</title>     <link rel="stylesheet"            href="index.css"> </head>  <body>     <div class="box1">         <h1>GeeksforGeeks</h1>         <h3>How To Create a             Menu Icon using CSS         </h3>         <div class="box">             <div class="div1 menu"></div>             <div class="div2 menu"></div>             <div class="div3 menu"></div>         </div>     </div> </body>  </html> 
CSS
@import url( 'https://fonts.googleapis.com/css2?family=Poppins&display=swap');  .menu {     height: 7px;     margin: 3px;     width: 50px;     background-color: green;       border-radius: 10px; }  .box {     display: flex;     flex-direction: column;     justify-content: center;     align-items: center;     height: 70px;     width: 80px;     border: 2px solid black;     border-radius: 20px;     box-shadow: rgba(74, 62, 62, 0.45) 0px 7px 19px;  }  .box1 {     display: flex;     flex-direction: column;     justify-content: center;     align-items: center;     height: 100vh;     font-family: 'Poppins', sans-serif; }  h1 {     color: green; } 

Output:

menusim

Animated Menu Icon using CSS

In this approach, we will design a animated menu icon with the help of CSS properties by incorporating three horizontal lines and adding animation in such way that whenever user hover on menu icon it changes to cross icon smoothly via transform property.

Approach

  • First create the basic structure of the project using different elements including <div>, <h1>, and <h3>.
  • For creating a simple menu icon with three horizontal bars there are three <div> elements defined in the HTML file. Give them styling with different CSS properties like height, margin, width, and background color.
  • There are other CSS properties are used as well like box-shadow, flexbox properties for giving a pleasing effect to the menu icon.
  • For animation transform property is defined for class menubar1 and class menubar3. Set opacity to 0 for class menubar2.

Example: The example shows how To Create a Menu Icon with animation.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport"            content="width=device-width,initial-scale=1.0">     <link rel="stylesheet"            href="index.css"> </head>  <body>     <div class="box1">         <h1>GeeksforGeeks</h1>         <h3>           How To Create a Menu            Icon using CSS           </h3>         <div class="box">             <div class="menubar menubar1"></div>             <div class="menubar menubar2"></div>             <div class="menubar menubar3"></div>         </div>     </div> </body>  </html> 
CSS
@import url( 'https://fonts.googleapis.com/css2?family=Poppins&display=swap');  .menubar {     height: 7px;     width: 50px;     background-color: green;     border-radius: 10px;     margin: 7px;     transition: 0.7s; }  .box:hover>.menubar1 {     transform: translate(0, 14px) rotate(40deg);     background-color: red; }  .box:hover>.menubar2 {     opacity: 0; }  .box:hover>.menubar3 {     transform: translate(0, -14px) rotate(-40deg);     background-color: red; }  .box {     height: 60px;     width: 60px;     border: 2px solid black;     border-radius: 20px;     padding-top: 5px;     box-shadow: rgba(74, 62, 62, 0.45) 0px 7px 19px;  }  .box1 {     display: flex;     align-items: center;     height: 100vh;     justify-content: center;     flex-direction: column;     font-family: 'Poppins', sans-serif; }  h1 {     color: green; } 

Output:

menuiconanimated


Next Article
How to create Vertical Menu using HTML and CSS ?

S

shivanigupta18rk
Improve
Article Tags :
  • Web Technologies
  • CSS
  • CSS-Questions

Similar Reads

  • How To Create A Dropup Menu Using CSS?
    A Dropup menu is a type of menu in web design that expands upwards from its trigger element instead of the traditional dropdown direction. Dropup menus are often used in contexts such as navigation bars, form selections, and interactive elements. Below are the approaches used for creating the dropup
    6 min read
  • How to create a mega menu using HTML and CSS ?
    HTML is a markup language used to create web pages and CSS is a stylesheet language used to design a document written in a markup language such as HTML. In this article, we are going to know how can we create a mega menu on our web page with the help of only HTML and CSS. Mega menus are a type of ex
    4 min read
  • How to create Vertical Menu using HTML and CSS ?
    In This article, we will learn how to create vertical menus by using HTML and CSS. Vertical Menu: We can create a vertical menu in the form of buttons and a scrollable menu. Vertical Menu is the buttons arranged in the vertical menu bar/navbar. How to create a vertical menu using buttons: We can cre
    2 min read
  • How to Create iPod Template using HTML and CSS ?
    The iPod template will create the look and feel of a classic iPod, with a sleek design and functional layout. The code creates a visually appealing iPod-like template with responsive design features and FontAwsome icons are used to enhance the look of the project. PreviewApproachFirst, create the st
    3 min read
  • How to Create Nested Sub Menu using CSS ?
    CSS Nested Sub-Menus refers to Dropdown Menus that are contained within another dropdown menu. These are commonly used in navigation menus to organize and structure content hierarchically. In this article, we are going to build a nested sub-menu using CSS, it will consist of a nav bar with various l
    3 min read
  • How to create a top navigation bar using CSS?
    A top navigation bar is a horizontal bar that typically contains links to different sections of a website. It is a fundamental part of a website's layout and helps users navigate easily. In this article, we will explore different approaches to creating a top navigation bar using CSS. These are the f
    3 min read
  • How to create Radial Menu in CSS ?
    There are so many ways to create a radial menu by using the CSS property. The font icon, letters, and or image are used in the radial menu. That radial button can be linked with the sites. Set the position, height, and width of a radial button by using CSS. There is another approach using JavaScript
    3 min read
  • How to create a Home icon using jQuery Mobile ?
    jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will be making a Home icon using jQuery Mobile. Approach: First, add jQuery Mobile scripts needed for your project. <link rel="stylesheet" hr
    1 min read
  • How to create a Grid icon using jQuery Mobile ?
    jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will be making a Grid icon using jQuery Mobile. Approach: First, add jQuery Mobile scripts needed for your project. <link rel="stylesheet" hr
    1 min read
  • How to Create an Image Overlay Icon using HTML and CSS ?
    Image overlay Icon can be an impressive addition to interactive detail or a set of features for your website. This article content will divide the task into two sections, the first section creating the structure and attach the link for the icon. In the second section, we will design the structure us
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences