Responsive Nav Bar

 HTML CODE FOR NAV BAR :- 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://kit.fontawesome.com/a076d05399.js"></script>
    <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
    <script>
        $(document).ready(function(){
            $('#icon').click(function(){
                $('ul').toggleClass('show');
          });
        });
    </script>

</head>
<link rel="stylesheet" href="nav.css">
<body>
    <nav>
        <label class="logo">BiplavMX</label>
        <ul>
            <li><a class="active" href="#">Home</a></li>
            <li><a href="#">About</a></li>
            <li><a href="#">Contact Us</a></li>
            <li><a href="#">Services</a></li>
        </ul>
        <label id="icon">
            <i class="fas fa-bars"></i>
        </label>
    </nav>
    <section></section>
    
</body>

</html>

CSS code for Nav bar
*{
    padding0%;
    margin0%;
    text-decorationnone;
    list-stylenone;
}
body{
    font-familyImpact, Haettenschweiler, 'Arial Narrow Bold'sans-serif
}
nav{
    height80px;
    width100%;
    backgroundrgb(732114);
}
label.logo{
    font-size35px;
    font-weightbold;
    colorrgb(253253253);
    padding0px 100px;
    line-height80px;
}
nav ul{
    floatright;
    margin-right40px;
}
nav li{
    displayinline-block;
    margin0 8px;
    line-height80px;
}
nav a{
    colorwhite;
    font-size18px;
    text-transformuppercase;
    border1px solid transparent;
    padding7px 10px;
    border-radius3px;
}
a.active,a:hover{
    border1px solid white;
    transition0.5s;

}
nav #icon{
    colorwhite;
    font-size30px;
    line-height80px;
    floatright;
   margin-right40px;
   cursorpointer;
   displaynone;
}
@media(max-width:1048px){

    label.logo{
        padding-left60px;
        font-size32px ;
    }
    nav ul{
        margin-right20px;
    }
    nav a{
        font-size17px;
    }

}
@media(max-width:909px){
    nav #icon{
        displayblock;
    }
    nav ul{
        positionfixed;
        width100%;
        height100vh;
        background#2f3640;
        top80px;
        left-100%;
        text-aligncenter;
        transitionall 0.5s;
    }
    nav li{
        displayblock;
        margin50px 0;
        line-height30px;
    }
    nav a{
        font-size20px;

    }
    a.active,a:hover{
        bordernone;
        coloryellow;

    }
    nav ul.show{
        left0;
    }
}
section{
    backgroundurl("https://cdn.pixabay.com/photo/2019/03/03/21/44/road-4032928_960_720.jpg"no-repeat;
    background-sizecover;
    heightcalc(100vh - 80px);

}











Comments