-1

我正在使用 Bootstrap 4-beta2nav-pills来实现选项卡式界面。

如何将某些元素对齐到屏幕右侧?

ml-auto最后一项的设置li不起作用。拆分ulin twoul也不起作用,因为它允许tabright与 . 等同时处于活动状态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>
4

1 回答 1

0

原来navbar是 flex,所以特定于 flex 的类正在帮助:

<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>
于 2017-12-16T19:56:06.750 回答