-1

I want to use Bootstrap and React to make the same menu as in the top image.

enter image description here

But no matter what alignment you put, you get a menu like on the bottom image.

enter image description here

the current sources looks like this:

 <Navbar expand="sm" bg="light" className="w-50 general_menu">
  <Nav>
   <Nav.Link className="active">Left One</Nav.Link>
   <Nav.Link>Left Two</Nav.Link>
   <Nav.Link>Left Three</Nav.Link>
   <Nav.Link className="border-left pl-2">Right One</Nav.Link>
  </Nav>
</Navbar>

Tell me please, what changes do I have to make to place the navmenu last item as in the top image?

Zhihar
  • 1,306
  • 1
  • 22
  • 45

2 Answers2

2

Apply css to Right One link: margin-left: auto or add class ml-auto to Last link:

<Nav.Link className="border-left pl-2 ml-auto">Right One</Nav.Link>
Muhammad Ali
  • 2,538
  • 2
  • 16
  • 21
-1

Use inside left-side navbar css class mr-auto.

<ul class="navbar-nav mr-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="#">Features</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Pricing</a>
  </li>
</ul>
<span class="navbar-text">
Place your right side element here
</span>

This code get from original Bootstrap Navbar. navbar sample

Pavel Petrovich
  • 734
  • 10
  • 9
  • this code will put all the items to the right, and I only need to put one item to the right and the rest to the left. – Zhihar Jun 03 '20 at 15:50