I'm having a problem with bootstrap 3 navigation, i have some content on the left, center and right. it seems there is no option for centering the navigation.
http://jsfiddle.net/29tQt/embedded/result/
I'm trying to get the links titled "center" to be in the center of the page, how can i achieve that ?
<nav class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <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> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="active"><a href="#">Center</a> </li> <li><a href="#">Center</a> </li> <li><a href="#">Center</a> </li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="#">Right</a> </li> <li><a href="#">Right</a> </li> </ul> </div> </div> </nav>
ml-auto class in Bootstrap can be used to align navbar items to the right. The . ml-auto class automatically aligns elements to the right.
You can move the nav elements to the center by putting text-align:center on the ul because the list elements have been set to inline-block which means they can be centred in the same way that you can centre text.
Thank you all for your help, I added this code and it seems it fixed the issue:
.navbar .navbar-nav { display: inline-block; float: none; } .navbar .navbar-collapse { text-align: center; }
Source
Center content in responsive bootstrap navbar
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