I am working with the Bootstrap 4 default navbar and I just want to justify the menu items to the right, not the left.
This should be simple right? But I've been Googling without success for 25 minutes now.
I've tried adding ml-auto
and justify-content-end
to the menu div, neither are helping.
Here is my code: https://www.bootply.com/oZD5wplHVi#
UPDATE: It seems I was incorrectly using Bootstrap 3, oops. I would like to use Bootstrap 4, so I have updated my example, and tried adding .float-right
(code):
<div class="navbar navbar-dark bg-dark fixed-top navbar-expand-md">
<div class="container">
<a class="navbar-brand" href="#">Brand</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target=".navbar-collapse">☰</button>
<div class="collapse navbar-collapse float-right">
<ul class="nav navbar-nav">
<li class="active nav-item"><a href="#" class="nav-link">Home</a>
</li>
<li class="nav-item"><a href="#about" class="nav-link">About</a>
</li>
<li class="nav-item"><a href="#contact" class="nav-link">Contact</a>
</li>
</ul>
</div>
</div>
</div>
But still no joy... What am I doing wrong?
Update 2: Replaced with new clean question Bootstrap 4: Justify menu to right in navbar? without confusing edits.