Boostrap 4 menu align right side in navbar

Boostrap 4 menu align right side in navbar

In Boostrap 3 menubar,.navbar-right class is used to bring the menu to the right side.Now .navbar-right class is deprecated.

How to align menu to right side using Bootstrap 4

As we already discussed that Bootstrap 4 is built on Flexbox layout, there is change in implementation accordingly.
Following code-snippet will highlight the changes in HTML code

Bootstrap Menu

<nav class="navbar navbar-expand-lg navbar-light fixed-top justify-content-between">
        <a class="navbar-brand" href="#">Cafe Express</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav ml-auto">
            <li class="nav-item active">
              <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Catering</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Menu</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Restaurant</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#" title="Gift Coupons" alt="Gift Coupons"><i class="fas fa-gift"></i></a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Locate</a>
            </li>
          </ul>
        </div>
      </nav>
    

Bootstrap4 menu
 



Also read previous article - Font awesome 5

Comments

Popular posts from this blog

How to initialize Datatable plugin?

Datatables.net - Plugin options

What are some mistakes people make when they start learning HTML, CSS and JavaScript?