I am using Bootstrap 4-beta2's nav-pills
to implement tabbed interface.
How do I align some elements to the right of the screen?
Setting ml-auto
on the last li
item does not work. Splitting up the ul
in two ul
's does not work either because it allows tabright
to be active at the same time as, say, tableft1
.
<nav class="fixed-top bg-dark">
<div class="navbar">
<a class="navbar-brand" href="#tabmain">Brand</a>
<ul class="nav nav-pills mr-auto">
<li class="nav-pill active"><a class="nav-link" href="#tableft1" data-toggle="pill">TabLeft1</a></li>
<li class="nav-pill"><a class="nav-link" href="#tableft2" data-toggle="pill">TabLeft2</a></li>
<li class="nav-pill"><a class="nav-link" href="#tabright" data-toggle="pill">TabRight</a></li>
</ul>
</div>
</nav>
Turns out the navbar
is flex, so flex-specific classes are helping:
<nav class="fixed-top bg-dark">
<div class="navbar justify-content-start flex-nowrap">
<a class="navbar-brand" href="#tabmain">Brand</a>
<ul class="nav nav-pills w-100">
<li class="nav-pill active"><a class="nav-link" href="#tableft1" data-toggle="pill">TabLeft1</a></li>
<li class="nav-pill"><a class="nav-link" href="#tableft2" data-toggle="pill">TabLeft2</a></li>
<li class="nav-pill ml-auto"><a class="nav-link" href="#tabright" data-toggle="pill">TabRight</a></li>
</ul>
</div>
</nav>