Skip to main content

How to create the navbar of the website in less then 10 minutes || Part 2

 Hey guys Today in this post I am going to give you the source code of the Part 2 of the video called "How to create the navbar of the website in less then 10 minutes". I have optimized the source code completely. If you want to get it then copy this source code below:




Here's the code of index.html file:

<!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>Good navbar design part-2 - codeandman</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <nav id="navbar">
        <li><a href="#">Home</a></li>
        <li><a href="#">Contact Us</a></li>
        <li><a href="#">Our Services</a></li>
        <li><a href="#">Blog</a></li>
        <li><a href="#">Portfolio</a></li>
        <button id="btn">Dark Mode</button>
    </nav>
    <script src="index.js"></script>
</body>
</html>

Here's the code of the style.css file:

* {
    margin0;
    padding0;
    box-sizingborder-box;
}

li {
    list-stylenone;
}

a {
    text-decorationnone;
    font-family: cursive;
    font-weight800;
    font-styleitalic;
    colorwhite;
    text-transformuppercase;
}

nav {
    backgroundrgb(25500);
    displayflex;
    align-itemscenter;
    justify-contentspace-around;
    height10vh;
    transitionall 1s ease-in;
}
#btn{
    padding:6px;
    color:white;
    font-familyArialHelveticasans-serif;
    font-weightbold;
    font-style:italic;
    outline:none;
    border:2px solid blue;
    background:blue;
    border-radius:10px;
    box-shadow2px 3px 5px 1px blue;
    transition:all 0.3s ease-in
}

Here's the source code of the index.js file:

const button = document.getElementById('btn');
const navbar = document.getElementById('navbar');
button.addEventListener('click',()=>{
    if(navbar.style.background === "rgb(255, 0, 0)"){
        navbar.style.background = 'black';
        button.innerText = 'Light Mode';
    }
    else{
        navbar.style.background = 'rgb(255, 0, 0)';
        button.innerText = "Dark Mode";
    }
})

I hope that you liked this source code.

Share it to all those who want this.

Comments

Popular posts from this blog

Arrays and conversion in Javascript || javascript complete course || #7 (sourcecode)

hey guys how are you all today in this post I am going to give you the source code of my video called arrays and  conversion in JavaScript so let's begin:- // ARRAYS in javascript console . log (" This is arrays in js ") var arr1 = [ 32 , 34 , 23 , 23 , 234 ," this ", {     name:" Gautam ",     class : " 8th ",     rollno: 6 } ] console . log ( arr1 ) console . log ( arr1 [ 5 ]) console . log ( arr1 .length) console . log ( arr1 . concat (' main ')); console . log ( arr1 ); // // ---------------------------------------------------- // CONVERSION IN JAVASCRIPT // Converting in to strings var num1 = 45 ; console . log ( num1 ); var str1 = String ( num1 ); console . log ( str1 ); console . log ( typeof str1 ); console . log ( typeof num1 ); var number1 = 33453434 ; console . log ( number1 , typeof number1 ); var string1 = number1 . toString (); console . log ( string1 , typeof string1 ); // ----------------------------...

types of operators in javascript || javascript course || codeandman (sourcecode)

hey guys how are you all today in this post I am going to give you the source code of my video called types of operators in javascript. so let's begin : here's the complete source code and the video:- // ------------------------------------------------------------------------------------ // COMPARISON OPERATORS IN JAVASCRIPT console . log (" COMPARISON OPERATORS IN JAVASCRIPT ") console . log ( 32 == 32 ) // checking if 32 is equal to 32 console . log ( 32 != 32 ) // checking if 32 is not equal to 32 console . log ( 32 >= 31 ) // checking if 32 is greater or equal to 31 console . log ( 32 < 33 ) console . log ( 32 > 30 ) console . log ( 32 <= 09 ) // ASSIGNMENT OPERATORS console . log (" --------------------------------------- ") console . log (" Assignment operators in javascript ") var d = 34 ; var e = 3 ; var a = 10 ; console . log ( d ) console . log ( d += 1 ) console . log ( d -= 3 ) console . log ( e *= 2 ) console . log...

Complete HTML Tutorial for beginners

Complete HTML Tutorial for beginners   I f you want to read this in a pdf than you can get this ebook:- Getting started with the html About This Course The html is the language for creating web pages. It is used for defining the content with the html you can create very simple web pages with CSS you can make the simple web page stylish and with the Javascript you can add logic to those stylish web pages. if you want to earn money from the web development then it is compulsory for you to learn these three languages. Today in this post you will learn the html completely. so let's begin:- Introduction to Html The html is the language for defining the elements of the web page. It stands for hyper text markup language. It is easy to learn. It is the basic language for creating web pages. Tags and Elements in the HTML There are two things in the HTML:- Tags - It is the part of the text which is used for creating content.  Elements - When we insert content inside a html tag then it ...