Create a full-screen menu on click

Having a menu has become an indispensable classic. But having a menu that takes up the whole screen is ideal when you want your site to be totally responsive (and therefore suitable for mobile devices, for example). This article will help you to set up a full-screen menu that is activated on click!
•
Updated on August 14, 2026
•
3 min read
Believemy logo

Having a menu has become an essential classic. But having a full-screen menu is ideal when you want your site to be fully responsive (and therefore adapted to mobile devices, for example). This article will help you set up a full-screen menu that triggers on click!

You can find the entire tutorial on our Instagram account

 

Step 1

To start, we need to create the structure of our site: so let's move on to HTML.

HTML
<nav>
      <div class="backdrop"></div>
      <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">Blog</a></li>
        <li><a href="#">Projects</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </nav>
    
    <button>
      Menu
    </button>

There’s nothing very complicated here. Note especially that we are using a backdrop class which will allow us to create a shadow that will trigger and cover the entire page when the button is clicked.

 

Step 2

Now let's style our button, giving it a modern look:

CSS
button {
      background: #ff9234;
      color: white;
      border: 0;
      padding: .5em 1em;
      font-size: 1.5em;
      border-radius: 1em;
      outline: 0;
      cursor: pointer;
      transition: all .1s;
    }
    button:hover {
      background: #35d0ba;
    }

 

Step 3

Now let's move on to styling the menu once it's deployed:

CSS
nav {
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      display: none;
    }
    
    ul {
      list-style: none; padding: 0; z-index: 2;
    }
    
    ul li {
      text-align: center;
      animation: .3s print;
    }
    
    li a {
      text-decoration: none; font-size: 3em;
      text-transform: uppercase;
      font-weight: bold; font-family: arial;
      color: white;
    }
    
    ul li a:hover { color: #ff9234; }
    
    .open {
      display: flex;
      justify-content: center;
      align-items: center;
    }

A bit longer, but still simple. We will create an animation later, which is why we are calling an animation in the li tag named print.

You can also note that there is an open class that serves no purpose at the moment. This class will be added using JavaScript to open our menu. We are also using flexbox to horizontally and vertically center all the menu links.

 

Step 4

Now let's move on to our backdrop class and thus to our shadow! Here, nothing very new—we will position the class as absolute and set "top", "left", "right", and "bottom" to 0 to make it cover the entire page. We will also use an animation to make the shadow appear, which we will call fade.

CSS
.backdrop {
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0, 0, 0, .9);
      cursor: pointer;
      animation: fade .1s;
    }

 

Step 5

Our design is now complete; we just need to create the animations to display our beautiful menu with a final class.

CSS
@keyframes print {
      from {
        margin-top: -50px; opacity: 0;
      }
      to {
        margin-top: 0; opacity: 1;
      }
    }
    
    @keyframes fade {
      from {
        opacity: 0;
      }
      to {
        opacity: 1;
      }
    }

 

Step 6

Now all that's left is to make everything work using JavaScript.

JAVASCRIPT
const button = document.querySelector('button');
    const nav = document.querySelector('nav');
    const backdrop = document.querySelector('.backdrop');
    
    button.addEventListener('click', () => {
      nav.classList.add('open');
    });
    
    backdrop.addEventListener('click', () => {
      nav.classList.remove('open');
    });

When the "Menu" button is clicked, we add the open class to our navigation bar, which will make it appear.

If the user clicks on the shadow (backdrop), we remove the open class and hide the navigation bar.

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Create a menu that spans the entire page using CSS

From time to time we have to ask our visitors which page they want to go to, by displaying the main sections of our website. This menu is often not very pleasant to use, so let's find out together in this article how to make it much more modern, with beautiful animations that will make your passers-by want to visit your site!

December 9, 2024

Detecting the "swap" to close a menu with CSS

Think about your users when they visit your website on their mobile devices: allowing them to close your menu using the "swap" will make their experience on your site much easier, so you'll have a better user experience, which increases your chances of building loyalty. Let's find out how in this article!

December 9, 2024

Creating circled buttons on hover with HTML and CSS

For a menu or to encourage your readers to share your website, share buttons are essential elements to add to your website. Let's find out how to make them more modern with a "neon" effect that will surround the icon selected by your user.

December 9, 2024

Creating a NEON button with CSS

Creating a button is one thing! But creating a button that your visitors want to click is something else entirely. In any case, this neon button will catch the eye of everyone who visits your pages.

December 9, 2024

Make an arrow that expands when hovered over with CSS

Whether it's to make your users want to see your project, read your article or access a page on your website, presenting your link with an arrow will make it easier to catch your visitors' eye! Let's find out in this article how to animate this arrow to enhance your readers' experience.

December 9, 2024

Creating an "Old School" button with CSS

Let's find out how to create an original button that's right up to date!

December 9, 2024

Creating a modal window without using JavaScript

Have you often wanted to create a modal window (a window that opens inside your website) but don't know anything about JavaScript? Let's find out how!

December 9, 2024

Create a clean, modern timeline using html and css

Whether you want to show a purchasing process, the highlights of your career on your portfolio, or anything else, learn how to create a sleek, modern timeline to show it off!

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.