0

Is it possible in bootstrap 3 to center brand name in the middle of the menu item? For example there is four menu item, i want two items on the left side, and two on the right side and brand name in the middle of these two menu links. Thnaks in advance for the help.

Omar
  • 32,302
  • 9
  • 69
  • 112
Sajjad Ahmad
  • 143
  • 3
  • 17

4 Answers4

0

Step 1 Wrap a <div class="pull-left"> around the two icons you want on the left

Step 2 move this div before the <a class="navbar-brand"

Step 3 Wrap a <div class="pull-right"> around the two icons you want on the right. Make sure this div follows the navbar-brand

This method can help you, however it is best if you post the relevant code here.

Hope this helps!

0

You can use the nav-justified class...

<div class="navbar">
  <ul class="nav nav-justified">
    <li><a href="#">Link</a></li>
    <li><a href="#">Link</a></li>
    <li><a href="#">Link</a></li>
    <li><a href="#">Brand</a></li>
    <li><a href="#">Link</a></li>
    <li><a href="#">Link</a></li>
    <li><a href="#">Link</a></li>
  </ul>
</div>

Demo: http://bootply.com/105175

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
0

Do it like my code. Get the anchor tag with navbar-brand out of the navbar-headerand place it after the closing div. like in the code below. navbar code

<nav class="navbar navbar-default" role="navigation">
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>    
  </div>
  <a class="navbar-brand" href="#">Brand</a>
  <div class="navbar-collapse collapse">
    <ul class="nav navbar-nav navbar-left">
        <li><a href="#">Left</a></li>
        <li><a href="#about">Left</a></li>
    </ul>
  </div>
</nav>

Place this code into your css file

.navbar-brand
{
    position: absolute;
    width: 100%;
    left: 0;
    text-align: center;
    mar
}

Here is the link to the working example http://www.bootply.com/98314

Harman Preet
  • 207
  • 3
  • 11
0

You can use a much simpler approach too, just setting a percentage:

.navbar-brand {
  position: absolute;
  left: 50%;
}

Side Note: I haven't tested with IE. Usually I don't like percentages, but... it works!

flapjack
  • 704
  • 1
  • 8
  • 13
  • This puts it dead in the middle of the right edge. You would have to compensate by subtracting the size of the element, divide it by two etc. Too complicated. – Joshua Dance Feb 19 '15 at 20:23
  • You could also use this method by using css transform. http://stackoverflow.com/a/34150526/3123861 – Bryan Willis Dec 08 '15 at 07:48