Embarking on a new journey in web development, I am currently enrolled in a webdev course and diving into the world of CSS through Bootstrap. While the instructional videos were based on Bootstrap 3, I am determined to master Bootstrap 4. Currently, I am grappling with the concept of navbars and struggling to understand how elements align to the right. My confusion stems from the use of 'mr-auto' in the ul tag, particularly when it comes to aligning a button outside of the ul. I am aware that removing 'mr-auto' disrupts the alignment of the button to the right. However, I am perplexed as to how 'mr-auto' affects the button outside the ul. I believe a clear explanation of this will significantly enhance my understanding. I deeply appreciate any assistance provided. Thank you in advance.
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo02">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<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="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<button>Click</button>
</div>
</nav>
Edit: I am truly grateful for everyone's input. My understanding has been vastly improved. Thank you all!