Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I center these Twitter bootstrap 3 navbar links?

I'm wondering on how I can center the bootstrap 3's navbar menu items. I know they have included a .nav-justified class but that will just conflict with navbar-nav if used together. I belive it is being looked into by the dev team.

So is there any work around with CSS that I can achieve a navbar that will keep the navbar menu items/links justified even when the container it is in is re-sized.

Here's a Jsfiddle for you if you need it.

like image 768
ProEvilz Avatar asked Aug 11 '13 18:08

ProEvilz


People also ask

How do I center a navbar brand?

To set navbar brand center you need to add . navbar-brand-center class in navbar <nav> tag.


2 Answers

The .nav-justifed class is to be used with nav-tabs / nav-pills (see bootstrap docs) and not nav-bar. The two concepts are very different and should not be confused.

However, you can achieve the effect you are looking for by adding the following css:

.navbar-nav.nav-justified > li{
    float:none;
}

nav-justifiednow plays nice with navbar-nav:

<ul class="nav navbar-nav nav-justified">

See updated jsFiddle.

like image 165
edsioufi Avatar answered Oct 15 '22 09:10

edsioufi


If using LESS, you can do the following:

.navbar-nav {
  .nav-justified;
}
like image 41
XåpplI'-I0llwlg'I - Avatar answered Oct 15 '22 09:10

XåpplI'-I0llwlg'I -