Create a Curtain Menu using HTML and CSS Last Updated : 04 Dec, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report This article will show you how to create a Curtain menu navbar effect with the help of HTML and CSS. The curtain menu means revealing or pulling down the menu items like a curtain. HTML is used to create the structure of the curtain menu and applies styles on that element to make like curtain menu effect. Also, we will add a close button to the corner. Example 1: Here, we create a pull-down curtain menu. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <title> Create a Curtain Menu with HTML and CSS </title> <style> .curtain-menu { position: fixed; top: 0; left: 0; width: 100%; height: 0; background-color: #4b8b01; overflow: hidden; transition: 0.5s; } .curtain-menu a { display: block; color: white; text-align: center; padding: 15px; text-decoration: none; font-size: 18px; } .curtain-menu a:hover { background-color: #2a93d5; } .menu-button { font-size: 24px; cursor: pointer; position: fixed; top: 20px; left: 20px; z-index: 1; color: white; background-color: #4b8b01; border: none; padding: 10px; border-radius: 5px; } .menu-button:hover { background-color: #2a93d5; } .close-button { position: absolute; top: 10px; right: 10px; font-size: 18px; color: white; background-color: #4b8b01; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; } .close-button:hover { background-color: #2a93d5; } .menu-open { height: 100vh; } h1 { text-align: center; } </style> </head> <body> <button class="menu-button" onclick="toggleCurtain()"> ☰ Menu </button> <div class="curtain-menu" id="curtainMenu"> <button class="close-button" onclick="toggleCurtain()"> ✖ Close </button> <a href="#" onclick="toggleCurtain()">Home</a> <a href="#" onclick="toggleCurtain()">About</a> <a href="#" onclick="toggleCurtain()">Users</a> <a href="#" onclick="toggleCurtain()">Contact</a> </div> <h1>Welcome to GeeksforGeeks</h1> <script> function toggleCurtain() { var curtainMenu = document.getElementById("curtainMenu"); curtainMenu.classList.toggle("menu-open"); } </script> </body> </html> Output: Example 2: Here, we create a Horizontal Curtain Menu. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <title>Horizontal Curtain Menu</title> <style> .curtain-menu { position: fixed; top: 0; left: 0; width: 0; height: 100%; background-color: #4b8b01; overflow: hidden; transition: 0.5s; } .curtain-menu a { display: block; color: white; text-align: center; padding: 15px; text-decoration: none; font-size: 18px; } .curtain-menu a:hover { background-color: #2a93d5; } .menu-button { font-size: 24px; cursor: pointer; position: fixed; top: 20px; left: 20px; z-index: 1; color: white; background-color: #4b8b01; border: none; padding: 10px; border-radius: 5px; } .menu-button:hover { background-color: #2a93d5; } .close-button { position: absolute; top: 10px; right: 10px; font-size: 18px; color: white; background-color: #4b8b01; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; } .close-button:hover { background-color: #2a93d5; } .menu-open { width: 100%; } h1 { text-align: center; } </style> </head> <body> <button class="menu-button" onclick="toggleCurtain()"> ☰ Menu </button> <div class="curtain-menu" id="curtainMenu"> <button class="close-button" onclick="toggleCurtain()"> ✖ Close </button> <a href="#" onclick="toggleCurtain()"> Home </a> <a href="#" onclick="toggleCurtain()"> About </a> <a href="#" onclick="toggleCurtain()"> Users </a> <a href="#" onclick="toggleCurtain()"> Contact </a> </div> <h1>Welcome to GeeksforGeeks</h1> <script> function toggleCurtain() { var curtainMenu = document.getElementById("curtainMenu"); curtainMenu.classList.toggle("menu-open"); } </script> </body> </html> Output: Comment More infoAdvertise with us Next Article How to Create a Search Bar using HTML and CSS V vkash8574 Follow Improve Article Tags : Project Web Technologies Geeks Premier League Web Templates Geeks Premier League 2023 +1 More Similar Reads 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 Create A Bottom Navigation Menu using HTML and CSS This article will show you how to create a bottom navigation menu using HTML and CSS. The navigation menu is an essential component in modern web design. It allows users to navigate through a website easily. Here, we use HTML to create the structure of the Bottom Navigation menu, and CSS add styles 2 min read How to Create a Website Using HTML and CSS? Creating a website using HTML and CSS is a foundational skill if you are learning web development. HTML (HyperText Markup Language) is used to structure content, while CSS (Cascading Style Sheets) is used for styling, including colors, fonts, margins, and positioning. In this article, weâll go throu 5 min read How to Create a Search Bar using HTML and CSS Creating a search bar in HTML and CSS is simple and essential for enhancing user experience on your website. A search bar allows users to quickly find specific content, making it a common feature in website navigation menus. In this guide, we'll show you how to create a search bar in HTML. By follow 3 min read 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 Menu Icon using CSS ? 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 c 3 min read Like