Center Bootstrap Navbar -- do not understand why navigation won't center

Viewed 11644

I just started to learn bootstrap today and I was working with their example on this page http://getbootstrap.com/examples/offcanvas/

As you can see if you go to that page, the navigation is aligned to the left. I have attempted to use what I do in normal CSS, which is:

margin-right:auto and margin-left:auto

I also tried

text-align:center

Neither of these have worked and I have read their navigation documentation and I don't understand what I am suppose to do differently here.

Below is code from that navigation page. I have attempted to put the tags in all 4 navigation containers at once and individually:

<div class="navbar navbar-fixed-top navbar-inverse" role="navigation">
      <div class="container">
        <div class="navbar-header" >
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">Project name</a>
        </div>
        <div class="navbar-collapse collapse" style="height: 1px;margin: auto;text-align: center;">
          <ul class="nav navbar-nav">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>
          </ul>
        </div><!-- /.nav-collapse -->
      </div><!-- /.container -->
    </div>
3 Answers
Related