Skip to main content

Create responsive NavBar using HTML and CSS (No JavaSccript) - scoobcode

Here in this blog, we will learn how to create a responsive navbar in just some line of HTML and CSS code. No need for javascript for the design. 

Full tutorial video: https://youtu.be/JmcN_f7aKd8

Output

responsive_navbar
Desktop View

Mobile View

Source code

👉 HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive NavBar</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <header>
        <b class="logo">Scoobcode</b>
        <input type="checkbox" name="" id="tapmenu">
        <label for="tapmenu" class="tapnav">
            <span></span>
            <span></span>
            <span></span>
        </label>
        <nav class="navmenu">
            <a href="#" class="menu">Home</a>
            <a href="#" class="menu">About</a>
            <a href="#" class="menu">Contact</a>
        </nav>
    </header>
    <section>
        <h1>This is a Responsive NavBar</h1>
    </section>
</body>
</html>

👉 CSS

*{
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
    text-decoration:none ;
}

header{
    height: 15vh;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: black;
}
.logo{
    font-size: 35px;
    color: white;
}
.menu{
    color: rgb(255, 255, 255);
    font-size: 25px;
    padding: 10px 20px;
    border-radius: 5px;
}
.menu:hover{
    background-color: turquoise;
    color: black;
}
.tapnav{
    display: none;
}
span{
    display: flex;
    height: 3px;
    width: 20px;
    background-color: white;
    margin: 5px;
}
#tapmenu{
    display: none;
}

section{
    height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* responsive menu  */

@media (max-width: 900px){
    .navmenu{
        position: fixed;
        height: 100vh;
        width: 100%;
        background-color: black;
        top: 15vh;
        left: -100%;
        transition: all 0.3s ease;
    }
    .menu{
        display: flex;
        justify-content: center;
        line-height: 60px;
    }   
    .menu:hover{
        background-color: transparent;
        color: turquoise;
    }
    .tapnav{
        display: block;
    }

    #tapmenu:checked ~ .navmenu{
        left: 0;
    }
}

You can support me to like this blog and share it with your programmer friends. Go to my youtube channel scoobcode and watch the full tutorial video.

Comments

Popular posts from this blog

Create a simple landing page using HTML & CSS - scoobcode

A landing page is the most important thing for businesses. Here I show you how to create a simple landing page for your businesses. It is simple and easy to learn. For this project, I used HTML & CSS. To watch the full video tutorial Click here Output Landing page Source code 👉 HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Simple landing page</title> <link rel="stylesheet" href="style.css"> </head> <body> <header> <div class="logo"> <b>LOGO</b> </div&

Create NavBar using HTML & CSS (flexbox) - scoobcode

The navigation bar is the most important part of a webpage or website. There have many ways to make a beautiful navbar. Here in this blog,  we are going to learn some basic use of flexbox. How to create a navbar using flexbox property in CSS. I've also uploaded the full tutorial video you can check the video. Click here to watch the video. To start the code we need a code editor or IDE. Here I use  Visual studio code  (recommended) for my coding. To download  Visual studio code   click here Here is the output Tips Press ! to get Emmet Abbreviation (Work in Visual studio code) Source code      HTML code <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>NavBar</title>     <link rel="stylesheet" href=&quo

Add preloader animation on website just some step of code (HTML, CSS, JavaScript) - scoobcode

Preloader is a unique feature for a website, this gives a professional look to a website. Here in this blog, I will share my code, where you going to learn how to add a preloader animation effect in just some line of HTML, CSS, and JavaScript code. Note: Copy the code and make your own design. Also, go to our YouTube channel for more useful content. Full video tutorial:  https://youtu.be/7KNABcF-xz0 Output Preloader animation After preloader Source code 👉  HTML <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Simple landing page</title>     <link rel="stylesheet" href="style.css"> </head> <body>     <div id="preloader"></div>     </div>     <header>