导航栏中心 - 垂直

时间:2016-09-28 22:20:54

标签: html css twitter-bootstrap

有人可以帮助我将导航栏居中,使其垂直居中在页面上吗?

我希望导航栏的中心链接位于顶部的标题中,而不是像现在一样向左浮动。

提前致谢

<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
      <div class="navbar-header">
        <button aria-controls="navbar" aria-expanded="false" class=
        "navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse"
        type="button"><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=
        "#"></a>
      </div>


      <div class="collapse navbar-collapse" id="navbar">
        <ul class="nav navbar-nav">
          <li class="active">
            <a href="#header-container"><strong>HOME</strong></a>
          </li>


          <li>
            <a href="#meetthebandcontainer"><strong>MEET THE BAND</strong></a>
          </li>


          <li>
            <a href="#photocontainer"><strong>PHOTOS</strong></a>
          </li>


          <li>
            <a href="#videocontainer"><strong>VIDEOS</strong></a>
          </li>


          <li>
            <a href="#getintouchcontainer"><strong>GET IN TOUCH</strong></a>
          </li>
        </ul>
      </div>
      <!--/.nav-collapse -->
    </div>
  </nav>

1 个答案:

答案 0 :(得分:1)

尝试使用navbar class

在div上移动带有容器类的div
<td><center><%= link_to "View", patrol_hit_patrol_report_path(@patrol_hit, patrol_report) %></center></td>