How to create Bottom navbar with HTML  and CSS

How to create Bottom navbar with HTML and CSS



How to create Bottom navbar with HTML and CSS



Hello Friends, Today, In this post we about how to create an responsive and cool bottom Navigation bar with the help oh HTML and CSS. So keep visiting my blog for more web site tool. also give some suggesion in the comment box for better content.

Thanks.......


Source From https://codepen.io/myacode/pen/PoqWmqL?editors=0010

HTML CODE : -

<div class="container">
  <div class="bottom-nav">
    
    <input type="radio" name="radio" value="1" id="tab-1" />
    <label class="icon home" for="tab-1">
      <ion-icon name="home-outline"></ion-icon>
      <ion-icon class="fill" name="home"></ion-icon>
    </label>
    
    <input type="radio" name="radio" value="2" id="tab-2" checked/>
    <label class="icon cart" for="tab-2">
      <ion-icon name="cart-outline"></ion-icon>
      <ion-icon class="fill" name="cart"></ion-icon>
    </label>
    
    <input type="radio" name="radio" value="3" id="tab-3" />
    <label class="icon fav" for="tab-3">
      <ion-icon name="heart-outline"></ion-icon>
      <ion-icon class="fill" name="heart"></ion-icon>
    </label>
    
    <input type="radio" name="radio" value="4" id="tab-4" />
    <label class="icon profile" for="tab-4">
      <ion-icon name="person-outline"></ion-icon>
      <ion-icon class="fill" name="person"></ion-icon>
    </label>

  </div>
</div>



CSS Code :-



**::before*::after {
    margin0;
    padding0;
    box-sizinginherit;
  }
  
  html {
    box-sizingborder-box;
    font-size62.5%;
    overflow-yscroll;
  }
  
  .container {
    min-height100vh;
    displayflex;
    justify-contentcenter;
    align-itemscenter;
    background#c988f8;
    transitionbackground 0.4s ease;
  }
  
  .bottom-nav {
    background#fff;
    width48rem;
    height12rem;
    border-radius0 0 3rem 3rem;
    box-shadow0 0.4rem 1rem 0 rgba(5555550.2);
    padding1rem;
    displayflex;
    justify-contentspace-around;
    align-itemscenter;
    positionrelative;
  }
  .bottom-nav input {
    displaynone;
  }
  .bottom-nav label {
    cursorpointer;
    width5rem;
    height5rem;
    displayflex;
    justify-contentcenter;
    align-itemscenter;
    color#b5c4da;
    z-index200;
    positionrelative;
  }
  .bottom-nav label::before {
    content"";
    positionabsolute;
    width7rem;
    height7rem;
    border-radius50%;
    transformscale(0);
    transitionall 0.2s cubic-bezier(0.6450.0450.3551);
  }
  .bottom-nav ion-icon {
    font-size3.5rem;
    colorinherit;
  }
  .bottom-nav input:checked + .home {
    color#ff90b5;
  }
  .bottom-nav input:checked + .home > ion-icon:first-child {
    opacity0;
  }
  .bottom-nav input:checked + .home::before {
    background#ffdfea;
    transformscale(1);
  }
  .bottom-nav input:checked + .cart {
    color#A439F1;
  }
  .bottom-nav input:checked + .cart > ion-icon:first-child {
    opacity0;
  }
  .bottom-nav input:checked + .cart::before {
    background#d9bcee;
    transformscale(1);
  }
  .bottom-nav input:checked + .fav {
    color#00d1c7;
  }
  .bottom-nav input:checked + .fav > ion-icon:first-child {
    opacity0;
  }
  .bottom-nav input:checked + .fav::before {
    background#c3eeec;
    transformscale(1);
  }
  .bottom-nav input:checked + .profile {
    color#ffc460;
  }
  .bottom-nav input:checked + .profile > ion-icon:first-child {
    opacity0;
  }
  .bottom-nav input:checked + .profile::before {
    background#ffebc7;
    transformscale(1);
  }
  .bottom-nav input:checked + label .fill {
    transformscale(1);
    opacity1;
  }
  
  .fill {
    positionabsolute;
    left0.8rem;
    transformscale(0);
    opacity0;
    transitionall 0.2s cubic-bezier(0.6450.0450.3551);
  }



JavaScript Code :-

$('label').on("click",function() {
    $index = $(this).prevAll().length;
    
    if($index === 1) {
      $('.container').css('background''#ffa6c3');
    } else if($index === 3) {
      $('.container').css('background''#c988f8');
    } else if($index === 5) {
      $('.container').css('background''#7ce2dd');
    } else {
      $('.container').css('background''#ffd284');
    }
  });