Center content in responsive bootstrap navbar

后端 未结 11 2192
自闭症患者
自闭症患者 2020-11-22 08:40

I\'m having trouble centering my content in the bootstrap navbar. I\'m using bootstrap 3. I\'ve read many posts, but the CSS or methods used will not work with my code! I\'m

11条回答
  •  广开言路
    2020-11-22 08:52

    There's another way to do this for layouts that doesn't have to put the navbar inside the container, and which doesn't require any CSS or Bootstrap overrides.

    Simply place a div with the Bootstrap container class around the navbar. This will center the links inside the navbar:

     
    

    If you want the then align body content to the center navbar, you also put that body content in the Bootstrap container tag.

    Not everyone can use this type of layout (some people need to nest the navbar itself inside the container). Nonetheless, if you can do it, it's an easy way to get your navbar links and body centered.

    You can see the results in this fullpage JSFiddle: http://jsfiddle.net/bdd9U/231/embedded/result/

    Source: http://jsfiddle.net/bdd9U/229/

提交回复
热议问题