Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 4 alpha 6 nav-tabs align item right

I am trying to create a tab menu that has nav-item dropdown to the far right of the menu.

Bootstrap 4 alpha 5, with float-xs-right its working: http://codeply.com/go/FCFPpRqhZd

Bootstrap 4 alpha 6, i changed to float-right but it isnt working: http://codeply.com/go/5mddDUv1M6

Have idea?

like image 659
emulatalk1 Avatar asked Feb 01 '17 00:02

emulatalk1


People also ask

How do I align navbar items to the right in Bootstrap 4?

ml-auto class in Bootstrap can be used to align navbar items to the right. The . ml-auto class automatically aligns elements to the right.

How do I create a right side navigation bar in Bootstrap?

The key is the class "mr-auto" on the left nav, which will push the right nav to the right. You also need to add navbar-toggleable-md or it will stack in a column instead of a row. Note I didn't add the remaining toggle items (e.g. toggle button), I added just enough to get it to formatted as requested.

How do I align navbar items to the right in Bootstrap 5?

The navbar items can be aligned using flex utility. Use . justify-content-end class on collapse menu to justify items to the right.

How to align items to the right in Bootstrap 5 navbar?

By default, the Bootstrap 5 navbar components are aligned to the left. Here, we will learn to align items to the right. As the navbar is built with flexbox. The navbar items can be aligned using flex utility. Use .justify-content-end class on collapse menu to justify items to the right.

What classes are used to align navbar content?

Since the Navbar is still based on flexbox, auto margins OR flexbox utility classes are still used to align Navbar content. For example, use me-auto...

What's new in Bootstrap Alpha 6?

With Alpha 6, we’ve made Bootstrap’s extensive suite of utilities—including classes for display, float, and flexbox, and more— completely responsive. To keep these class names as approachable and representative of their scope as possible, we’ve also made two important changes to their naming scheme.

How do I add navigation tabs to the navigation menu?

Turn the nav menu into navigation tabs with the.nav-tabs class. Add the.active class to the active/current link. If you want the tabs to be togglable, see the last example on this page.


1 Answers

Since alpha 6 is now flexbox, float will no longer work in this case.

Use the ml-auto utility class instead for margin-left:auto

<div class="col-md-12">
    <ul class="nav nav-tabs">
        <li class="nav-item">
            <a href="#" class="nav-link active">Link 1</a>
        </li>
        <li class="nav-item">
            <a href="#" class="nav-link">Link 2</a>
        </li>
        <li class="nav-item">
            <a href="#" class="nav-link">Link 3</a>
        </li>
        <li class="nav-item">
            <a href="#" class="nav-link">Link 4</a>
        </li>
        <li class="nav-item dropdown ml-auto">
            <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Account</a>
            <div class="dropdown-menu">
                <a class="dropdown-item" href="#">Action</a>
                <a class="dropdown-item" href="#">Another action</a>
                <a class="dropdown-item" href="#">Something else here</a>
                <div class="dropdown-divider"></div>
                <a class="dropdown-item" href="#">Separated link</a>
            </div>
        </li>
    </ul>
</div>

http://www.codeply.com/go/hhV1aM49zz

like image 175
Zim Avatar answered Jan 12 '23 08:01

Zim