I am working with Bootstrap 4 and I have a specific requirement for the navbar-brand item to be positioned on the far right side. By default, the menu appears on the left side.
I have attempted to use classes like ml-auto
, mx-auto
, mr-auto
, pull-right
, but none of them are giving me the desired outcome.
Although mx-auto
worked well for small screens, centering the navbar-brand when the hamburger menu is visible, I need a solution that also works when the regular menu is displayed.
Below is the code I am currently using:
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top main-menu">
<a href="#" class="navbar-brand navbar-right">BSB Feedback</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#mainNav" aria-controls="mainNav" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse" id="mainNav">
<ul class="navbar-nav mr-auto">
<li class="nav-item homeLink">
<a class="nav-link" href="/">
<span aria-hidden="true" class=" fa fa-spacer-right fa-home"></span>
</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/">Give Feedback</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="/managefeedback/">Manage Feedback</a>
</li>
</ul>
</div>
</nav>