Bootstrap - 导航栏中的底部对齐菜单

时间:2014-11-15 21:56:17

标签: html css twitter-bootstrap

我需要将菜单文本与Bootstrap 3导航栏的底部对齐。

我的代码是:

    <nav class="navbar navbar-default">
      <div class="container">
        <div class="navbar-header">
           <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
           </button>
         <a class="navbar-brand" href="#"><img class="img-responsive" src="/assets/img/outa.png" width="120px;"/></a>
        </div>
        <div class="collapse navbar-collapse" id="myNavbar">
          <ul class="nav navbar-nav pull-right">
              <li><a href="/browser/saved/">Saved searches</a></li>
              <li><a href="../index.html">Settings</a></li>
              <li><a href="../index.html">About</a></li>
              <li><a href="../index.html">Sign In</a></li>
          </ul>
        </div>
      </div>
    </nav>

这使菜单在阴影导航栏中垂直居中。是否可以更改此菜单,使菜单位于阴影导航栏区域底部上方4px处?

1 个答案:

答案 0 :(得分:1)

这应该可以解决问题。

#myNavbar {
    position: relative;
}

#myNavbar .nav {
    position: absolute; 
    bottom: 0; 
    right: 0;
    margin-bottom: -10px;
}

JSFiddle