I am new to this and developing in general. I am taking a webdev course, currently learning CSS through Bootstrap. The videos were created during bootstrap 3, but I am trying to learn on Bootstrap 4. Currently, I am trying to understand navbars and I am having difficulty understanding how elements align right. This is mostly from bootstrap documentation, except that the button is replacing a search element. I get that when I take off mr-auto in the ul tag then the button is no longer aligned right. How come this mr-auto even applies to the button outside of the ul? I think this answer will help bridge the gap in a lot of my understanding. Thank you in advance for the help.
<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: Thanks so much everyone. This makes way more sense now.