我已经看到了一些引导引导程序{= 2,但是我使用v3,而我想要做一个水平行链接在行/容器中心.这是我的标记:
<div class="footer row"> <div class="col-12"> <ul id="menu-main" class="nav navbar-nav"> <li class="text-center"> <%= link_to "Home",root_path %> </li> <li class="text-center"> <%= link_to "About",root_path %> </li> <li class="text-center"> <%= link_to "Help",root_path %> </li> </ul> </div> </div>
解决方法
这应该是你正在寻找的.
如果您希望将其作为固定页脚,只需将navbar-fixed-bottom类添加到< nav class =“navbar navbar-default”role =“navigation”>元件.
HTML
<nav class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse navbar-ex1-collapse"> <ul class="nav navbar-nav"> <li class="active"><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> </nav>
CSS
@media (min-width: 768px){ .navbar-nav{ float:none; margin: 0 auto; display: table; table-layout: fixed; } }