Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap 3 - how do I place the brand in the center of the navbar?

Tags:

I am using Bootstrap 3. I would like a navbar with only the brand in it. No other links or anything else. And I want the brand to be in the center. How can I accomplish this? The following css doesn't work:

.navbar-brand {     text-align: center; } 
like image 645
tadasajon Avatar asked Nov 16 '13 22:11

tadasajon


People also ask

How do I center a navbar brand in Bootstrap?

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

How do I center navbar in Bootstrap 3?

If you want this as a fixed-footer, just add navbar-fixed-bottom class to the <nav class="navbar navbar-default" role="navigation"> element. @Ruben Are you using Respond. js ? it is required for media queries in IE8 and IE9 See the Bootstrap Browser Support Docs for more info on this.

How do I center a logo in a navigation bar?

So, in order to resolve this problem, we have assigned the display property of the image tag to “block” and then assign proper width and height to it. Assign the margin to “auto”. You will see that the logo image is now centered in the navigation bar.

How do I align navbar brand to right?

Move the brand above the navbar-header and give it the class navbar-right. This puts your brand on right when in desktop views, and it goes left in mobile views, properly keeping the menu button as the rightmost element.


Video Answer


2 Answers

css:

.navbar-header {     float: left;     padding: 15px;     text-align: center;     width: 100%; } .navbar-brand {float:none;} 

html:

<nav class="navbar navbar-default" role="navigation">   <div class="navbar-header">     <a class="navbar-brand" href="#">Brand</a>   </div> </nav> 
like image 161
Bass Jobsen Avatar answered Sep 20 '22 15:09

Bass Jobsen


Use these classes: navbar-brand mx-auto

All other solutions overcomplicate the matter.

like image 36
stardust4891 Avatar answered Sep 20 '22 15:09

stardust4891