sticky Nav Bar

Sticky Nav Bar 





font awsome cdn link
       	
         <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" />
       	
html code
       	
         <nav>
      <input type="checkbox" id="check">
     <div class="auto-fix">
      <label class="logo"><img src="https://drive.google.com/uc?id=1LTcCNlJgYa1W5OsLmzCDvgd9BtcJjiku" alt=""></label></div><!--===  change logo   ====-->
      <!--====================================
          links home fee comtact about

========================================-->
      <ul>
        <li><a class="active" href="#">Home</a></li>
        <li><a href="feechart.html">Free Chart</a></li>
        <li><a href="#divOne">Contact</a></li>
        <li><a href="about.html">About</a></li>
      </ul>
    </nav>
    <label for="check" class="checkbtn bar">
    <pre>Menu </pre><i class="fas fa-bars"></i></label>
       	
css code
       	
        *{
  padding: 0;
  margin: 0;
  text-decoration: none;
  list-style: none;
  
 
}
/* end reset code */
/* body font  */
body{
  font-family: montserrat;
  
}

nav{
  background-color: white; /* navbar background color */
  height: 80px;
  width: 100%;
  z-index: 2;
  
}
label.logo{
  line-height: 90px;
padding-left: 6px;

}
label.logo img{
    background-color: #12d62f; 
    width: 100%; 
    height: 100%;
}
nav ul{
  float: right;
  margin-right: 20px;
}
nav ul li{
  display: inline-block;
  line-height: 80px;
  margin: 0 5px;
}
nav ul li a{
  color: black; /* links text color */
  font-size: 17px; /* font size */
  padding: 7px 13px;
  border-radius: 3px;
  text-transform: uppercase;
}
ul li a.active,ul li a:hover{
  background: #12d62f; /* hover color */
  transition: .5s;
  color: white;
}
.checkbtn{
  
 text-align: center;
  
  cursor: pointer;
  display: none;
}
#check{
  display: none;
}
/*=======================             
media qureses                                       ======================*/
@media (max-width: 952px){
  label.logo{
    
  
    padding-left: 10px;
  }
  nav ul li a{
    font-size: 16px;
  }
}
@media (max-width: 858px){
  .checkbtn{
    display: flex;
    align-items: center;
    justify-content: center;
  }
nav ul{
    position: fixed;
    width: 60%;
    height: 100vh;
    background-color: #12d62f;
    top: 0px;
    left: -100%;
    text-align: center;
    transition: all .5s;
    z-index: 3;
    
    
  }
  nav ul li{
    display: block;
    
    margin: 50px 0;
    line-height: 30px;
    
  }
  nav ul li a{
    font-size: 20px;
  }
 ul li a:hover,ul li a.active{
    background-color: white; /* open link background color like : open home home hutton background color white  */
    color: green;/* text color green */
  }
  #check:checked ~ ul{
    left: 0;
  }
}
@media (max-width: 359px){
label.logo{

    
    padding-left: 6px;
    
}
}
.auto-fix{
display: inline-block;
line-height: 90px;
    width: 220px;
  
}
.bar{
    position:fixed;
    width:90px;
    height:36px;
  
    top:14px;
     
    right: 15px;
    background-color:#12d62f;
    color:#FFF;
   
    text-align:center;
    font-size:18px;
    
    z-index:100;
}

       	

Post a Comment

0 Comments