Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Float certain list items right

I'm currently using bootstrap for the navigation bar, I have changed some things so it looks different. But I want to align 2 list items to the right side of the ul.

I have searched but I can't really find a working solution. Also keep in mind that I still want navigation bar to be fully responsive.

<div class="navbar">
<div class="navbar-inner">
    <div class="container">

        <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </a>

        <!-- Everything you want hidden at 940px or less, place within here -->
        <div class="nav-collapse collapse">
            <ul class="nav">
                <li class="active"><a href="#">Home</a></li>
                <li><a href="#">Video Library</a></li>
                <li><a href="#">Orphanages</a></li>
                <li><a href="#">The collective</a></li>
                <li><a href="#">What we do</a></li>
                <li><a href="#">Partners</a></li>
                <li class="donate"><a href="#">Donate</a></li>
           </ul>
        </div>
    </div>
</div>

I hope you guys can help me figure out how to do this. Thanks

What I have

What I need

like image 624
Sharpless512 Avatar asked Dec 21 '22 07:12

Sharpless512


1 Answers

I think the best solution is to split your links list in two:

        <ul class="nav">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#">Video Library</a></li>
            <li><a href="#">Orphanages</a></li>
            <li><a href="#">The collective</a></li>
            <li><a href="#">What we do</a></li>
       </ul>
       <ul class="nav pull-right">
            <li><a href="#">Partners</a></li>
            <li class="donate"><a href="#">Donate</a></li>
       </ul>

You could also add pull-right only to the correspondent li, but you'd need to modify the width of the ul for that to work.

like image 81
rvidal Avatar answered Jan 02 '23 20:01

rvidal