treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Bootstrap navbar: adding an element to the right side

  • Hi,

    Newbie here. I'm trying to put together a navbar using Bootstrap. There should be three buttons on the left, and there should be another button to the right of the navbar. I can't get the fourth button on the right corner.

        <div class="navbar navbar-fixed-top">
          <div class="navbar-inner">
              <div class="container">
                  <div class="nav-collapse collapse">
                      <ul class="nav" id="nav_list">
    
                          <div class="btn-group">
                              <button class="btn category" id="category_1" data-toggle="button">a</button>
                              <button class="btn category" id="category_2" data-toggle="button">b</button>
                              <button class="btn category" id="category_3" data-toggle="button">c</button>
                          </div>
    
                          <div class="nav-collapse collapse pull-right">
                              <ul class="nav" id="nav_options" style="text-align: right">
                                  <div class="button">Options</button>
                              </ul>
                          </div>
    
                      </ul>
                  </div><!--/.nav-collapse -->
              </div>
          </div>
        </div> <!-- /navbar -->
    

    This doesn't work.

    Any ideas?

    (Wanted to post this on codepen, but it doesn't support bootstrap, right?)

  • @tham, if you copy and paste this chunk of html, and the css associated with it into codepen, it should be just fine

  • @ChrisP, hmm, there's a lot of styles to copy paste, though :/

  • @tham, enough of the css for us to get the gist of what you're working with should do :)

  • I solved it anyway. The pull-right div had to come after /.nav-collapse Thanks!