how to make twitter bootstrap navbar fixed width?

19,059

Surround it with a div. Give that div a fixed width.

Something like:

<div class="navbar-outer">
  <div class="navbar">
     <!--here goes the rest of the code-->
  </div>
</div>

CSS:

.navbar-outer {
  width:500px;
}
Share:
19,059
Harry M
Author by

Harry M

Updated on June 04, 2022

Comments

  • Harry M
    Harry M almost 2 years

    How can I make twitter bootstrap navbar fixed width, while keeping it centered?

    I've tried adding a width parameter in .navbar, but then the navbar is misaligned.

    .navbar {
    overflow: visible;
    margin-bottom: 20px;
    color: #956362;
    *position: relative;
    *z-index: 2;
    width: 650px; 
    }
    

    I also tried

    <div class="span6 offset3">
    

    but this also makes it misaligned.

  • Harry M
    Harry M over 11 years
    Thanks! Also added margin-left: auto and margin-right: auto and got it to work!