How can I perfectly center the nav-items (links) on the navbar based on the browser window size in Bootstrap 4? Check out this code snippet:
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="#">Features</a>
<a class="nav-item nav-link" href="#">Pricing</a>
<a class="nav-item nav-link disabled" href="#">Disabled</a>
</div>
</div>
</nav>
I want to center the "navbar-nav" div exactly in the middle of the screen based on the browser's width. I've tried using mr-auto and ml-auto, but it doesn't center it perfectly. It ends up centering the div relative to the browser window width minus the logo width. How can I achieve perfect center alignment?
Changing the position to absolute has caused layout issues in collapsed mode. Are there any other methods that can help me achieve the desired centered effect?