How to create a Menu Icon using CSS ? Last Updated : 28 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 CSSAnimated Menu Icon using CSSSimple Menu Icon using CSSIn 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. ApproachFirst 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: Animated Menu Icon using CSSIn 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. ApproachFirst 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: Comment More infoAdvertise with us Next Article How to create a Menu Icon using CSS ? S shivanigupta18rk Follow Improve Article Tags : CSS Web Technologies CSS-Questions Similar Reads 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 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 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 How to create icon hover effect using CSS ? To style an icon's color, size, and shadow using CSS, use the color property to set the icon's color, font size to adjust its size, and text-shadow or box-shadow for adding shadow effects, creating a visually appealing and dynamic look.Using: hover Pseudo-ClassUsing the: hover pseudo-class, you can 2 min read How to create Right Aligned Menu Links using HTML and CSS ? The right-aligned menu links are used on many websites. Like hotels website that contains lots of options in the menu section but in case of emergency to make contact with them need specific attention. In that case, you can put all the menu options on the left side of the navigation bar and display 3 min read How to create a Hero Image using HTML and CSS ? A Hero Image is a large image with text, often placed at the top of a webpage. Hero images can be designed using HTML and CSS. This article contains two sections. The first section attaches the image and designs the basic structure. The second section designs the images and texts on the images. The 2 min read How to Create Scrollable Horizontal Menu using CSS? The scrollable horizontal menu is suitable for various screen sizes. To create a scrollable horizontal menu using CSS, you can make use of the overflow property on a container.Syntaxwhite-space: nowrapoverflow: auto;HTML<!DOCTYPE html> <html> <head> <style> div.scrollmenu { b 1 min read Like