I've seen some hacks for Bootstrap <=2 but I'm using v3 and I want to make a horizontal row of links that are centered within the row/container. Here's my markup:
<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>
This should be exactly what you are looking for.
Here is a jsFiddle Demo
If you want this as a fixed-footer, just add navbar-fixed-bottom
class to the <nav class="navbar navbar-default" role="navigation">
element.
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;
}
}
.nav.navbar-nav {
display: flex;
justify-content: center;
flex-wrap: wrap;
}
@media (min-width: 768px) {
.navbar-nav {
float: none;
}
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Help</a></li>
</ul>
</div>
</nav>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With