How to Create Full Screen Overlay Navigation Bar using HTML CSS and JavaScript ? Last Updated : 24 Apr, 2020 Comments Improve Suggest changes Like Article Like Report Create a full screen Navigation Bar: In this article, you will learn how to create a full-screen navbar for your website. There are three methods to create a full screen overlay navigation bar which are listed below: From Left From top No animation- Just show You will be required to create two divs. One for the overlay container and the other for the overlay content container. Step 1: The first step is to create an HTML file. html <div id="myNav" class="overlay"> <!-- Button to close the overlay navigation --> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">× </a> <!-- Overlay content --> <div class="overlay-content"> <a href="#">About</a> <a href="#">Services</a> <a href="#">Clients</a> <a href="#">Contact</a> </div> </div> <!-- Use any element to open/show the overlay navigation menu --> <span onclick="openNav()">open</span></div> Step 2: Add CSS to the file. css <style> overlay { height: 100%; width: 0; position: fixed; ] z-index: 1; left: 0; top: 0; background-color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0.9); overflow-x: hidden; transition: 0.5s; } ].overlay-content { position: relative; top: 25%; width: 100%; text-align: center; margin-top: 30px; } .overlay a { padding: 8px; text-decoration: none; font-size: 36px; color: #818181; /* Display block instead of inline */ display: block; /* Transition effects on hover (color) */ transition: 0.3s; } .overlay a:hover, .overlay a:focus { color: #f1f1f1; } .overlay .closebtn { position: absolute; top: 20px; right: 45px; font-size: 60px; } @media screen and (max-height: 450px) { .overlay a { font-size: 20px } .overlay .closebtn { font-size: 40px; top: 15px; right: 35px; } } </style> Step 3: In the final step add JavaScript to the files. javascript <script> function openNav() { document.getElementById("myNav").style.width = "100%"; } function closeNav() { document.getElementById("myNav").style.width = "0%"; } //or function openNav() { document.getElementById("myNav").style.display = "block"; } function closeNav() { document.getElementById("myNav").style.display = "none"; } </script> Example 1: This example creating the Full Screen Overlay Navigation Bar from left. html <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> .overlay { height: 100%; width: 0; position: fixed; top: 0; left: 0; background-color: #1a6e1a; overflow-x: hidden; transition: 1.0s; } .overlay-content { position: relative; top: 25%; width: 100%; text-align: center; } .overlay a { padding: 10px; text-decoration: none; font-size: 40px; color: white; display: block; transition: 0.3s; } .overlay a:hover, .overlay a:focus { color: black; } .overlay .closebtn { position: absolute; top: 10px; right: 35px; font-size: 70px; } </style> </head> <body> <div id="myNav" class="overlay"> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()"> × </a> <div class="overlay-content"> <a href="#">About</a> <a href="#">Practice</a> <a href="#">Courses</a> <a href="#">Contact</a> </div> </div> <span style="font-size:35px;cursor:pointer" onclick="openNav()"> ≡ </span> <h2>GeeksForGeeks</h2> <p> Click on the nav bar icon to see full screen overlay: </p> <script> function openNav() { document.getElementById( "myNav").style.width = "100%"; } function closeNav() { document.getElementById( "myNav").style.width = "0%"; } </script> </body> </html> Output: Example 2: This example creating the Full-Screen Overlay Navigation Bar from the top. html <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> .overlay { height: 0%; width: 100%; position: fixed; top: 0; left: 0; background-color: #1a6e1a; overflow-y: hidden; transition: 1.0s; } .overlay-content { position: relative; top: 25%; width: 100%; text-align: center; } .overlay a { padding: 10px; text-decoration: none; font-size: 40px; color: white; display: block; transition: 0.3s; } .overlay a:hover, .overlay a:focus { color: black; } .overlay .closebtn { position: absolute; top: 10px; right: 35px; font-size: 70px; } </style> </head> <body> <div id="myNav" class="overlay"> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()"> × </a> <div class="overlay-content"> <a href="#">About</a> <a href="#">Practice</a> <a href="#">Courses</a> <a href="#">Contact</a> </div> </div> <span style="font-size:35px;cursor:pointer" onclick="openNav()"> ≡ </span> <h2>GeeksForGeeks</h2> <p> Click on the nav bar icon to see full screen overlay: </p> <script> function openNav() { document.getElementById( "myNav").style.height = "100%"; } function closeNav() { document.getElementById( "myNav").style.height = "0%"; } </script> </body> </html> Output: Example 3: This example creating the Full-Screen Overlay Navigation Bar without animation. html <!DOCTYPE html> <html> <head> <meta name="viewport" content= "width=device-width, initial-scale=1"> <style> .overlay { height: 100%; width: 100%; display: none; position: fixed; top: 0; left: 0; background-color: #1a6e1a; } .overlay-content { position: relative; top: 25%; width: 100%; text-align: center; } .overlay a { padding: 10px; text-decoration: none; font-size: 40px; color: white; display: block; transition: 0.3s; } .overlay a:hover, .overlay a:focus { color: black; } .overlay .closebtn { position: absolute; top: 10px; right: 35px; font-size: 70px; } </style> </head> <body> <div id="myNav" class="overlay"> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()"> × </a> <div class="overlay-content"> <a href="#">About</a> <a href="#">Practice</a> <a href="#">Courses</a> <a href="#">Contact</a> </div> </div> <span style="font-size:35px;cursor:pointer" onclick="openNav()"> ≡ </span> <h2>GeeksForGeeks</h2> <p> Click on the nav bar icon to see full screen overlay: </p> <script> function openNav() { document.getElementById( "myNav").style.display = "block"; } function closeNav() { document.getElementById( "myNav").style.display = "none"; } </script> </body> </html> Output: Comment More infoAdvertise with us Next Article How to Create Full Screen Overlay Navigation Bar using HTML CSS and JavaScript ? S Slash_IT Follow Improve Article Tags : JavaScript Web Technologies Write From Home JavaScript-Projects Similar Reads How to create fullscreen search bar using HTML , CSS and JavaScript ? In this article, you will learn how to create a full-screen search Bar. Here You will be required to create two divs. One for the overlay container and the other for the overlay content container. HTML Code: The first step is to create an HTML file. Here we will create the basic structure for the se 2 min read How to create a revealing sidebar using HTML CSS and JavaScript? A revealing sidebar is a hidden UI element that becomes visible upon user interaction, such as clicking or swiping, providing navigation links. The content of the page will rotate and the navigation bar will reveal itself when the menu button is clicked. ApproachCreate an HTML file with headings and 3 min read Slide Down a Navigation Bar on Scroll using HTML, CSS and JavaScript To create a slide down navigation bar you need to use HTML, CSS, and JavaScript. HTML will make the structure of the body, CSS will make it looks good. This kind of sliding navbar looks attractive on a site. By using JavaScript you can easily make the navigation bar slideable when the user scrolls d 4 min read How to Create Shrink Header on Scroll using HTML, CSS and JavaScript ? The Shrink Navigation bar works when the user scrolls down the page. In this article, we will use HTML, CSS, and JavaScript to design a shrink navigation bar. HTML is used to create the structure, and CSS is used to set the style of the HTML structure to make it looks good. This kind of shrinking na 3 min read How to create a Landing page using HTML CSS and JavaScript ? A landing page, also referred to as a lead capture page, static page, or destination page, serves a specific purpose and typically appears as a result of online advertising or search engine optimization efforts. Unlike a homepage, a landing page is stripped of distractions and focuses on capturing v 7 min read How to Create a Modal Box using HTML CSS and JavaScript? We will learn how to create a modal dialog box using HTML, CSS, and JavaScript. A modal is a pop-up dialog that appears on top of the main content and requires the user to interact with it before returning to the main screen.Approach to Create Modal BoxHTML Structure:Create a button that opens the m 2 min read How to Create Full-Page Tabs using CSS & JavaScript? Tabs are a common UI pattern used to organize content into multiple sections within a single page. In this article, we'll explore how to create full-page tabs using CSS and JavaScript. Full-page tabs allow users to switch between different sections of content while maintaining a clean and intuitive 3 min read How to create Vertical Navigation Bar using HTML and CSS ? After reading this article, you will be able to build your own vertical navigation bar. To follow this article you only need some basic understanding of HTML and CSS. Let us start writing our vertical navigation bar, first, we will write the structure of the navigation bar. In this tutorial, we crea 3 min read Create a Hoverable Side Navigation with HTML, CSS and JavaScript To create hoverable side navigation with icon on any website there is a need for two things HTML and CSS. If you want to attach the icons on the navigation bar then you need a font-awesome CDN link. These features make the website looks cool than a normal website where the nav-bar is old-school desi 4 min read How to create a Popup Form using HTML CSS and JavaScript ? To create a popup form using JavaScript, you can design a hidden overlay that becomes visible when triggered. We will use HTML for form elements, CSS for styling, and JavaScript to toggle the visibility of the overlay. This allows for a user-friendly and interactive way to display forms on your webp 3 min read Like