Skip to main content

Responsive Navigation Bar using HTML And CSS

 


HTML

<!DOCTYPE html>
  <head>
    <meta charset="utf-8">
    <title>Responsive Navigation | SkyCodingLab</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <nav>
        <input type="checkbox" id="check">
        <label for="check" class="checkbtn">
        <i class="fas fa-bars"></i>
        </label>
        <label class="logo">SkyCodingLab</label>
        <ul>
        <li><a class="active" href="#">Home</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Our Service</a></li>
        <li><a href="#">Blog</a></li>
        <li><a href="#">Contact Us</a></li>
      </ul>
    </nav>
    <section></section>
  </body>
</html>


===============
CSS
================
body{
    font-family: montserrat;
  }

*{

    padding: 0;
    margin: 0;
    text-decoration: none;
    list-style: none;
    box-sizing: border-box;

  }
 
  nav{

    background: #78079f;
    height: 80px;
    width: 100%;

  }

  label.logo{
    color: white;
    font-size: 35px;
    line-height: 80px;
    padding: 0 100px;
    font-weight: bold;
  }

  nav ul{
    float: right;
    margin-right: 20px;

  }
  nav ul li{
    display: inline-block;
    line-height: 80px;
    margin: 0 5px;

  }

  nav ul li a{
    color: rgb(255, 255, 255);
    font-size: 17px;
    padding: 7px 13px;
    border-radius: 3px;
    text-transform: uppercase;
  }

  a.active,a:hover{
    background: #01282c;
    transition: .5s;
  }

  .checkbtn{
    font-size: 30px;
    color: white;
    float: right;
    line-height: 80px;
    margin-right: 40px;
    cursor: pointer;
    display: none;
  }

  #check{
    display: none;
  }

  @media (max-width: 952px){
    label.logo{
      font-size: 30px;
      padding-left: 50px;

    }

    nav ul li a{
      font-size: 16px;
    }
  }
  @media (max-width: 858px){
    .checkbtn{
      display: block;
    }

    ul{
      position: fixed;
      width: 100%;
      height: 100vh;
      background: #313131;
      top: 80px;
      left: -100%;
      text-align: center;
      transition: all .5s;

    }
    nav ul li{
      display: block;
      margin: 50px 0;
      line-height: 30px;

    }

    nav ul li a{
      font-size: 20px;
    }
    a:hover,a.active{
      background: none;
      color: #be00fd;
    }
    #check:checked ~ ul{
      left: 0;
    }
  }

section{
  background: url(WEBSITEDESIGN.jpg) no-repeat;
  background-size: cover;
  height: calc(100vh - 80px);

}




Comments

Popular posts from this blog

Simple Responsive Side Navigation Bar in HTML CSS And JavaScript | Dashboard Sidebar Menu [Free Source Code]

  HTML CODE =============== <! DOCTYPE html >   < head >     < html lang = "en" dir = "ltr" ></ html >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < link rel = "stylesheet" href = "style.css" >     < link href = 'https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel = 'stylesheet' >   </ head > < body >   < div class = "sidebar_menu" >         < div class = "Logo" >         < i class = 'bx bxl-slack icon' ></ i >           < div class = "Text_Logo" >SkyCodingLab</ div >           < i class = 'bx bx-menu' id = "Button" ></ i >         </ div >       < ul class = "Nav_Item" >           < li >               < i class =

Simple Navbar With Flexbox in HTML, CSS| Create a Navigation Bar with Flexbox [Free Source Code] No Talking

HTML <! DOCTYPE html > < html >     < head >         < meta charset = "utf-8" >         < meta http-equiv = "X-UA-Compatible" content = "IE=edge" >         < title >Music App</ title >         < meta name = "description" content = "" >         < meta name = "viewport" content = "width=device-width, initial-scale=1" >         < link rel = "stylesheet" href = "css.css" >     </ head >     < body >         < div class = "header1" >           < div class = "head2" >                            < h1 >SkyCodingLab</ h1 >             </ div >             < div class = "head3" >                 < ul >                     < li >< a href = "#" >Home</ a ></ li >                     < li >< a href = "#&quo