luc debevere luc debevere - 6 months ago 50
CSS Question

How to set Bootstrap menu items from a navbar-nav inverse in the center?

Hello everyone and thank you for reading this.
I have a default bootstrap navbar that im using , i want the items to be centered and i tryed following methods which didn't work somehow (but seem to work for others) so i must be doing something wrong. Option 1 :

nav.nav-center{margin:0;float:none} .navbar-inner{ text-align:center}
Option 2 : .navbar-inner{text-align: center} .navbar-inner .nav{display:inline-block;float:none}
Option 3 : .navbar-inner{text-align: center}.navbar-nav {width:100%;text-align:center; > li {float: none;display: inline-block}
so none of the above worked. I don't understand why.Here is the fiddle Thank you in advance ! Kind regards


Thy this one

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

It is not a good practice to make such specific CSS rules, but this one works for me.