Bootstrap 3居中导航在链接底部添加5个像素

时间:2014-07-17 10:02:33

标签: javascript jquery twitter-bootstrap height navigationbar

我将nav菜单集中在Bootstrap中。我注意到我的CSS规则在链接底部添加了5个像素。当切换按钮未隐藏菜单时,您可以突出显示它(宽度> 768) 你能帮帮我吗?

Fiddle

HTML

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                        <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="#">Brand</a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="#">LINK</a></li>
                        <li><a href="#">LINK</a></li>
                    </ul>
                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->
        </nav>

CSS

.navbar .navbar-nav {
  display: inline-block;
  float: none;
}

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

提前致谢。

1 个答案:

答案 0 :(得分:0)

您只需将vertical-align: bottom;添加到.navbar .navbar-nav

即可

jsFiddle