Skip to main content

 Basic Navbar Toggle





Basic Html Code source:


<html>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="style.css"/>

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />


    <title> slider</title>

<body>

    <section>

        <nav>

            <div class="logo">

                brand   logo

            </div>

            <div class="sidebar">

            <i class="fas fa-bars "></i> </div>

            <div class="side-bar">

            <ul> 

                <li><a href="#">Home</a></li>

                <li><a href="#">About</a></li>

                <li><a href="#">Service</a></li>

                <li><a href="#">Gallery</a></li>

                <li><a href="#">Contact</a></li>


            </ul>

        </div>

        </nav>

    </section>


    <section class="background-img-banner">

       

    </section>


    <script src="index.js"></script>

</body>


</html>



2. Basic CSS code source:

*{

    box-sizing: border-box;

    padding: 0;

    margin: 0;

}


nav{

    background-color: #e2e2e2;

    height: 70px;

    width: 100%;

}

.logo{

    font-size: 36px;

    font-weight: 800;

    margin: 14px 21px;

    

    position:absolute;

    

}

ul{

    display: flex;

    float: right;

    margin: 21px 10px;

   

    

}

ul li{

    list-style: none;

    padding: 5px 15px;

    position: relative;

    margin: 0 5px;

    

  

}

ul li a{

    text-decoration: none;

    font-size: 20px;

    color: #032463;

    font-weight: 600;

}

ul li:hover{

    background-color: #032463;

    transition: .3s all;

    border-radius: 4px;

    

}

ul li:hover >a{

    color: #e2e2e2;

    transition: .3s all;

}


.background-img-banner{

    background-image: url(hero-bg.jpg);

    height: 100%;

    

    background-position: center;

    background-size: cover;


}

.background-img-banner::before{

    background-color: rgb(5 10 23 / 85%);

    position: absolute;

    content: "";

    width: 100%;

    height: 100%;

   

}


.sidebar i{

    padding: 15px;

    position: fixed;

    left: 85%;

    font-size: 28px;

    top: 10px;

    cursor: pointer;

    display: none;  

}




@media screen and (max-width: 676px) {

    .sidebar i{

        

        display: block;  

    }


    ul{

        display: inline;

        background: #071126;

        width: 100%;

        z-index: 9;

        position: absolute;

        top: 9%;

        margin: 0;

    }


    ul li{

        text-align: center;

        background-color: #e2e2e2;

        margin: 1px 0;

        padding: 9px 0;

    }

    .side-bar{

        display: none;

       transform: translate(100%);

       position:relative;

       top: 100%;

       z-index: 99;


    }

    .show-side-bar{

        

       display: block;

       

      

       transform: translate(0%);

       transition:all 0.5s linear;

      

    }

  }



3. basic javascript source code:

const bars= document.querySelector(".fa-bars");

const sidebar = document.querySelector(".side-bar");



bars.addEventListener("click", () => {

    

    sidebar.classList.toggle("show-side-bar")

});

4.output:



Comments

Popular posts from this blog

 What is web designing? 1. web designing meant layout of a website   2. we can design a website layout on photoshop, figma, in design, xd,  Adobe Illustrator   software  3. when a design is ready and approved by the client then start front-end development  4. front-end developer mean to develop a layout design by web designers and how is looking layout on the web browswe   web designer skills 1. Adobe photoshop 2.  Adobe Illustrator 3.  Adobe InDesign 4. Figma 5. Adobe XD if you want to become a web designer so you know very well this software and anyone in you become a master like a pro all software is used for mobile application layout design and logo design and website layout design front-end developer skills 1.html5 (it is the latest version of Html) 2. css3 ( it is the latest version of css) 3. Bootstrap5 (it is the latest version of bootstrap) 3. javascript (ECMA6 it is the latest version of javascript) 4. lear javascript...
 HOW TO MAKE TIME COUNTDOWN BASIC NEEDS: HARDWARE 1. COMPUTER/ LAPTOP SOFTWARE 1. TEXT EDITOR EXAMPLE : VISUAL STUDIO, ATOM, SUBLIME TEXT, NOTEPAD++  ETC... HAVE A BASIC KNOWLEDGE 1. HTML5 2. CSS3 3. JAVASCRIPT LET'S SEE OUTPUT IN VIDEOS: HTML CODE: <!-- DEVELOP BY DELHI KA CODER --> < html >      < title > Count-down develop by delhikacoder </ title >      < meta   charset = "utf-8" >      < meta   name = "viewport"   content = "width=device-width, initial-scale=1.0" >      < link   rel = "stylesheet"   href = "style.css" />        < script   src = "javascript.js"   defer ></ script >      < body >          < section >              <...