0

I am trying to get a full-width dropdown on a bootstrap 4 navbar. I am using a standard boot4 Navbar.

This is the navbar I am using

Here is how I need it to look :

enter image description here

<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
  <a class="navbar-brand" href="index.html">Start Bootstrap</a>
  <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarResponsive">
    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <a class="nav-link" href="about.html">About</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="services.html">Services</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="contact.html">Contact</a>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownPortfolio" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Portfolio
        </a>
        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownPortfolio">
          <a class="dropdown-item" href="portfolio-1-col.html">1 Column Portfolio</a>
          <a class="dropdown-item" href="portfolio-2-col.html">2 Column Portfolio</a>
          <a class="dropdown-item" href="portfolio-3-col.html">3 Column Portfolio</a>
          <a class="dropdown-item" href="portfolio-4-col.html">4 Column Portfolio</a>
          <a class="dropdown-item" href="portfolio-item.html">Single Portfolio Item</a>
        </div>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownBlog" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Blog
        </a>
        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownBlog">
          <a class="dropdown-item" href="blog-home-1.html">Blog Home 1</a>
          <a class="dropdown-item" href="blog-home-2.html">Blog Home 2</a>
          <a class="dropdown-item" href="blog-post.html">Blog Post</a>
        </div>
      </li>
      <li class="nav-item dropdown show">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownBlog" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
          Other Pages
        </a>
        <div class="dropdown-menu dropdown-menu-right show" aria-labelledby="navbarDropdownBlog">
          <a class="dropdown-item" href="full-width.html">Full Width Page</a>
          <a class="dropdown-item" href="sidebar.html">Sidebar Page</a>
          <a class="dropdown-item" href="faq.html">FAQ</a>
          <a class="dropdown-item" href="404.html">404</a>
          <a class="dropdown-item" href="pricing.html">Pricing Table</a>
        </div>
      </li>
    </ul>
  </div>
</div>

isherwood
  • 58,414
  • 16
  • 114
  • 157
  • Hi, thanks, i am afraid that is not working – Greenpoint It Support Jan 06 '20 at 16:45
  • What is not working? To whom are you replying? Please [take the tour](https://stackoverflow.com/tour) so you understand how this site works. If you're replying to David Leuliette regarding his answer, it demonstrably _does_ work--I checked myself in Chrome--and your comment should be down there. – isherwood Jan 06 '20 at 16:46
  • Oh, I think I understand. You're asking about the menu dropdown itself. This wasn't apparent from the link. A screenshot would show your desired outcome better. Also, you'll need to make an effort and show your progress. SO isn't a free outsourcing service. – isherwood Jan 06 '20 at 16:55
  • @isherwood, I was replying to the only person who commented! And yes as per my 1st message I was referring to the dropdown and not a full-width navbar. – Greenpoint It Support Jan 06 '20 at 16:58
  • I commented. Someone else _answered_. Your comment doesn't make sense with respect to my comment. See the problem? – isherwood Jan 06 '20 at 16:59
  • Here's a possible duplicate: https://stackoverflow.com/questions/49659305/how-to-make-a-bootstrap-4-full-width-dropdown-in-navbar – isherwood Jan 06 '20 at 16:59
  • @isherwood excellent I found one out of the three examples in that post. – Greenpoint It Support Jan 06 '20 at 17:12
  • If this question is indeed a duplicate it should be deleted. Thanks. – isherwood Jan 06 '20 at 17:15

1 Answers1

1
  1. Replace your class container with container-fluid
  2. Delete ml-auto from navbar-nav
isherwood
  • 58,414
  • 16
  • 114
  • 157
David Leuliette
  • 1,595
  • 18
  • 26