Skip to main content

Responsive Nav Bar (CODE)

 


CSS:


nav {
    background#373B69;
    height60px;
    width100%;
    border-bottom2px solid rgba(0001);
    box-shadow0 20px 30px rgba(0000.2);
}

label.logo{
    colorwhitesmoke;
    font-size25px;
    line-height60px;
    padding0px 80px;
    font-weightbold;
}

nav ul {
    float:  right;
    margin-right0 10px;
}

nav ul li {
    displayinline-block;
    line-height60px;
    margin0 5px;
}

/* p {
    max-width: 90%;
    padding-left: 50px;
    padding-top: 30px;

} */
nav ul li a{
    colorblack;
    font-size15px;
    padding7px 13px;
    border-radius3px;
    text-transformuppercase;
}

a.activea:hover{
    background#EBE5E2;
    transition0.5s;
}

.checkbtn {
    font-size25px;
    coloraliceblue;
    floatright;
    line-height80px;
    margin-right40px;
    cursorpointer;
    displaynone;
}

#check {
    displaynone;
}


@media(max-width952px) {
    label.logo {
        font-size30px;
        padding-left50px;
    }
    nav ul li a {
        font-size16px;
    }

}
@media (max-width858px) {
    .checkbtn {
        displayblock;
    }

    ul {
        positionfixed;
        width100%;
        height60%;
        background#13688C;
        top80px;
        left-100%;
        transitionall 0.3s;
        text-aligncenter;
    }
    nav ul li {
        displayblock;
        margin50px 0;
        line-height30px;
    }
    nav ul li a {
        font-size20px;
    }
    a:hovera.active {
        backgroundnone;
        colorwhite;
    }
    #check:checked ~ ul {
        left0;
    }
}




html :

 <nav>
      <input type="checkbox" id="check" />
      <label for="check" class="checkbtn">
        <i class="fas fa-bars"></i>
      </label>
      <label class="logo">MihirX</label>
      <ul>
        <li><a href="#" class="active">Home</a></li>
        <li><a href="#">Codding</a></li>
        <li><a href="#">Me Time</a></li>
        <li><a href="#">Fun</a></li>
        <li><a href="#">Work</a></li>
      </ul>
    </nav>



Comments

Popular posts from this blog

Topic Learned!

 Topic Learned! State : State is updated whenever user want to update it. Example : ToDo List Props:           Props would be whatever the current state is! useEffect:            componentDidMount() {             // Run This code while the app is loading          Example fetchUser();      } Alternative For componentDidMount(): In functional components    //On Every Render   useEffect (() => {     console . log ( "I re-rendered" );   }); Alternative For componentDidMount() but runs only in first Render: //On First Render/Mount - componentDidMount   useEffect (() => {     console . log ( "Component Is Mounted" );   }, []); Alternative for componentDidUpdate(): //On First Render + whenever the component changes   //componentDidUpdate alternative   useEffect (() => {   ...

VERCEL DEPLOYMENT ERROR

 VERCEL DEPLOYMENT ERROR Options | NextAuth.js (next-auth.js.org) Step 1 : cmd $ openssl rand -base64 32 (Copy generated key) Step 2: Go to Project Environment Variables Add NEXTAUTH_SECRET : Key  Step 3: Redeploy

Advanced JS Notes

 Advanced JS Notes : Arrow Functions:  Code:  let sumIs = ( a , b ) => a + b console . log ( sumIs ); let randomIs = () => Math . random ; document . addEventListener ( 'click' , () => console . log ( "click" );) Spread Operator // Spread Operator arr = [ 1 , 3 , 1 ]; let sum = ( a , b ) => a + b ; let s = sum (... arr ); // console.log(s); arr2 = [ 2 , 5 , 5 ]; let b = [... arr , ... arr2 ]; //Concating arr using spread console . log ( b ); // Spread With Obj let obj1 = {   name : "Mihir" ,   age : 24 ,   favStar : "TrishCollins" , }; let obj2 = { ... obj1 , name : "Rahul" , favStar : "SRK" }; // Object manipulation using spread operator console . log ( obj2 );