user1666411
user1666411

Reputation: 335

How to adjust navbar to a fixed width in Twitter Bootstrap?

Default navbar spans horizontally across the browser window.

<div class="navbar navbar-static-top">

How do you declare the navbar to be only 750px width and placed at the center?
Setting margin:auto; in the CSS doesn't work.

Upvotes: 1

Views: 7450

Answers (1)

albertedevigo
albertedevigo

Reputation: 18411

The .navbar-static-top you are using forces your navbar to become full-width. Remove that class and you will get a resizable navbar. Then, you can wrap it in a span# of the size you want:

<div class="container">
    <div class="row">
        <div class="span6 offset3">
            <div class="navbar">
                ...
            </div>
        </div>
    </div>
</div>

Here you have an example: http://jsfiddle.net/simbirsk/xAMYF/

Upvotes: 3

Related Questions