It seems like using .pull-*
won't do the trick as it's no longer supported in Bootstrap 4. Consider switching to .float-*
. While you're on the right path with .ml-auto
, make sure to apply it at the correct point.
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js" integrity="sha384-a5N7Y/aK3qNeh15eJKGWxsqtnX/wWdSZSKp+81YjTmS15nvnvxKHuzaWwXHDli+4" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
<nav class="navbar navbar-expand navbar-light bg-light">
<span class="navbar-brand text-color">MYlestone</span>
<div class="navbar-nav w-100">
<a class="nav-item nav-link" href="#">My Content</a>
<a class="nav-item nav-link" href="#">About</a>
<div class="ml-auto">
<a class="nav-item nav-link" href="#">Logout</a>
</div>
</div>
</nav>
In order to ensure that the element takes up 100% of the remaining space, add .w-100
to your .navbar-nav
. Also, wrap your final .nav-link
in a wrapper with .ml-auto
for proper alignment.
If needed, consider using multiple .navbar-nav
elements within the same collapse to achieve the desired outcome. These elements will condense into a hamburger menu if required. Here's an example utilizing multiple navigational menus:
<nav class="navbar navbar-expand navbar-light bg-light">
<span class="navbar-brand text-color">MYlestone</span>
<div class="navbar-nav">
<a class="nav-item nav-link" href="#">My Content</a>
<a class="nav-item nav-link" href="#">About</a>
</div>
<div class="navbar-nav ml-auto">
<a class="nav-item nav-link" href="#">Logout</a>
</div>
</nav>