0

In the floowing code, I have tried to set float:noneand centralizing techniques to push the items to the center of the navigation, but none has worked.

How can I have the items sit in the middle of the navigation bar?

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<nav class="navbar navbar-inverse navbar-fixed-top">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Home</a></li>
      <li><a href="#">Page 1</a></li>
      <li><a href="#">Page 2</a></li>
      <li><a href="#">Page 3</a></li>
    </ul>
  </div>
</nav>
syzd
  • 163
  • 1
  • 3
  • 15
  • Possible duplicate of [Center content in responsive bootstrap navbar](http://stackoverflow.com/questions/18777235/center-content-in-responsive-bootstrap-navbar) – vanburen Aug 24 '16 at 19:16

1 Answers1

0

You could do something like this:

.container-fluid{
  text-align: center;
}
.navbar .navbar-nav {
  display: inline-block;
  float: none;
}

This will center the items of your navigation. If you want to try this out, check this JS Fiddle here.

patrick
  • 881
  • 2
  • 9
  • 32