Bootstrap Navbar 置中

CSS加入以下class
.navbar .nav.pull-center {
  float: none;
  margin: 0 auto;
  display:inline-block;
  *display:inline; /* ie7 fix */
  *zoom:1; /* hasLayout ie7 trigger */
  vertical-align: top;
}

.navbar-inner {
  text-align:center;
}

然後建立navbar時在nav class後額外加個pull-center即可
範例:
<div class="navbar">
 <div class="navbar-inner">
  <a class="brand" href="#">Title</a>
  <ul class="nav pull-center">
   <li class="active"><a href="#">Home</a></li>
   <li><a href="#">Link</a></li>
   <li><a href="#">Link</a></li>
  </ul>
 </div>
</div>

沒有留言:

張貼留言