Sunny0101
Sunny0101

Reputation: 476

Bootstrap Nav-Bar not responsive

first time using Bootstrap to design a website and having issues with the menu. I've gone into see what the site looks like on different devices, as soon as it hits 800 x 600, the menu at the top does not stack on top. I've attached 3 images with only the first picture of where it looks correct. I have also included the viewport initial scale=1 within the head tag which I seen on another post...

Menu looking ok Menu not stacking correctly on small mobile device

Please could someone point me in the right direction to rectify the code?

<nav class="navbar navbar-expand-md">
    <div class="container-fluid">
    <a class="navbar-brand text-left" href="index.html">iStudy University <i class="fas fa-graduation-cap"></i></a>


        <div class="navbar-nav ml-auto">
        <a id="menu-nav" class="nav-item nav-link px-3" href="index.html"><i class="fas fa-home" ></i> Home</a>
        <a id="menu-nav" class="nav-item nav-link px-3" href="#"><i class="fas fa-info-circle"></i> About</a>
        <a id="menu-nav" class="nav-item nav-link px-3" href="contact.html"><i class="fas fa-envelope"></i> Contact Us</a>

        <form class="form-inline px-2" action="#">
            <button class="btn btn-dark" type="submit">Sign Up</button>
            <button class="btn btn-dark" type="submit"><i class="fas fa-sign-in-alt"></i>Login</button>
        </form>
        </div>
    </div>
</nav>


    #menu-nav{
color: white;
}

/*TO COME BACK TO - BACKGROUND IMAGE TO HOMEPAGE*/
.site-header {
  background: url(img/home-header.jpg) no-repeat center;
  background-size: cover;
        }

.site-header .layout-hero {
  min-height: 100vh;
}

.navbar, .btn-dark {
  font-family: 'Amatic SC', cursive;
  font-weight: 800;
  border-radius: 25px;
  color: white;
}

.navbar-brand {
  font-size: 2.5rem;
  font-family: 'Amatic SC', cursive;
  font-weight: 600;
  color: white;
}

/*This is for the i in the logo name */
.navbar-brand::first-letter {
  font-family: 'Charm', cursive;
  color: #f5f5f5;
  text-shadow: 1px 1px #45b39d;
}


/*This is to override the logo defult blue */
.navbar-brand:hover {
  color: white;
}

/*Just for the menu */
.navbar-nav {
  background-image: linear-gradient(to bottom right, #5dade2, #45b39d);;
  padding: 4px;
  border-radius: 25px;
  box-shadow: 1px 2px 1px slategrey;
}

.navbar-collapse .nav-link{
  display: inline-block;
  background :#45b39d;
}
/*for small  devices*/

@media(max-width: 767px){
  .navbar-brand {
    font-size: 2.1rem;
  }

  .navbar-dark .navbar-toggler {
    border-color: rgba(255,255,255,.5);
  }

}

Upvotes: 1

Views: 348

Answers (1)

elad BA
elad BA

Reputation: 1968

If all the items in the menu to appear one under another is what you wish, add this to your media query

 @media(max-width: 767px){
    // the code to add
    .form-inline{
       display:flex;
       flex-direction: column;
     }
   // end
  }

Upvotes: 1

Related Questions