Full-Screen Navigation Bar using HTML, CSS & JavaScript

Full-Screen Navigation Bar using HTML, CSS & JavaScript

 

Hello developers, today in this blog, you'll learn to create a Full-Screen Navigation Bar using HTML, CSS & JavaScript.

The navigation bar is a user interface element within a webpage that contains links to other sections of the webpage. This means that no matter what page you are viewing, you can use the navigation bar to visit other sections of the website.

In this blog(Full Screen Navigation Bar), there is a webpage with a navigation bar. The Full-Screen Navigation Bar consists of the image with a navigation bar that occupies the full screen of the webpage. The Navigation bar is the link that will redirect to the respective page. There is also a close button, where you can close the navigation bar. The navigation bars are like Home, Services, Products, Contacts, and so on.

The navigation bar is made to be fixed. When you hover over the navigation bar it will toggle the bar. JavaScript code has been used to show the active and the hover menu highlighted in the navigation bar.

The source code of this Full-Screen Navigation Bar is given below, if you want the source code of this program, you can copy it. You can use this Full-Screen Navigation Bar on your project.

Full-Screen Navigation Bar [Source Code]

To make this website, you would like to make three files: an HTML file, a CSS file & a JavaScript file. First, create an HTML file with the name of index.html and remember, you have to create a file with a .html extension.

<!DOCTYPE html> <html> <head> <title>Full Screen Navigation Bar|| Learningrobo</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="fullPageMenu" id="nav"> <div class="banner"> <img src="https://cdn.pixabay.com/photo/2020/05/18/16/17/social-media-5187243__340.png" alt="image"> </div> <div> <div class="nav"> <ul> <li><a href="#" data-text="Home">Home</a></li> <li><a href="#" data-text="Solutions">Solutions</a></li> <li> <a href="#" data-text="Services">Services</a></li> <li><a href="#" data-text="Products">Products</a></li> <li><a href="#" data-text="Portfolio">Portfolio</a></li> <li><a href="#" data-text="Contact">Contact</a></li> </ul> </div> <div class="credit">Made with <span style="color:tomato">❤</span> by <a href="https://www.learningrobo.com/">Learning Robo</a></div> </div> </div> <span class="menuicon" id="toggle" onclick="menuToggle()"></span> <script type="text/javascript" src="script.js"></script> </body> </html>
CSS provides style to an HTML page. To make the page attractive, create a CSS file with the name style.css, and remember that you have to make a file with a .css extension.


*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: sans-serif;
}

body {
    min-height: 100vh;
    background-color: #21D4FD;
    background-image: linear-gradient(19deg, #21D4FD 0%, #B721FF 100%);
}
.fullPageMenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #111;
    transition: 0.5s;
}

.fullPageMenu.active {
    top: -100%;
}

.fullPageMenu .banner {
    position: relative;
    width: 1000px;
    height: 100%;
}

.fullPageMenu .banner img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fullPageMenu .nav {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.fullPageMenu .nav ul {
    position: relative;
}

.fullPageMenu .nav ul li {
    position: relative;
    list-style: none;
    padding: 0 20px;
    margin: 5px 0;
    overflow: hidden;
    display: table;
}

.fullPageMenu .nav ul li:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #21D4FD;
    background-image: linear-gradient(19deg, #21D4FD 0%, #B721FF 100%);
    transition: transform 0.5s ease-in-out;
    transform: scaleY(0);
    transform-origin: bottom;
}

.fullPageMenu .nav ul li:hover:before {
    transition: transform 0.5s ease-in-out;
    transform: scaleY(1);
    transform-origin: top;
}

.fullPageMenu .nav ul li a {
    position: relative;
    color: #21D4FD;
    text-decoration: none;
    font-size: 2em;
    font-weight: 600;
    line-height: 1.5em;
    display: inline-block;
    text-transform: uppercase;
    transition: 0.5s ease-in-out;
}

.fullPageMenu .nav ul li a::before {
    content: attr(data-text);
    position: absolute;
    bottom: -100%;
    left: 0;
    color: #fff;
}

.fullPageMenu .nav ul li:hover a {
    transform: translateY(-100%);
    color: fff;
}

.menuicon {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #fff url(https://i.postimg.cc/k4rb3zpp/pngwave.png);
    background-size: 40px;
    cursor: pointer;
    background-repeat: no-repeat;
    background-position: 10px;
    border-radius: 50%;
}

.menuicon.active {
    background: #fff url(https://i.postimg.cc/25t1dMY5/pngegg-1.png);
    background-size: 30px;
    background-repeat: no-repeat;
    background-position: 10px;
}
.credit{
  margin: 10px;
  color:#fff;
}
.credit a{
    text-decoration: none;
    color: #21D4FD;
}
@media(max-width:991px) {
    .banner {
        display: none;
    }
}
JavaScript makes the page work functionally. At last, create a JavaScript file with the name of script.js, and remember that you've got to make a file with a .js extension.


 	function menuToggle() {
    var nav = document.getElementById("nav")
    var toggle = document.getElementById("toggle")
    nav.classList.toggle("active")
    toggle.classList.toggle("active")
}
We hope you will like this Full-Screen Navigation Bar using HTML, CSS & JavaScript.

Thank you for reading our blog. If you face any problem creating this Full-Screen Navigation Bar using HTML, CSS & JavaScript, then contact us or comment us. We'll try to provide a solution to your problem as soon as possible.

Thank you
Learning robo team

إرسال تعليق

Thank you
Learning robo team

Post a Comment (0)

أحدث أقدم
Learning Robo says...
code copied
Welcome