13

First of all, I already visited the other topics with the same question, not any answers for me.

Here is the bootstrap 3 nav:

enter image description here

As you can see in left, there is a "Brand" text there, for removing that in the source I removed:

<a class="navbar-brand" href="#">Brand</a>

The results is something like:

enter image description here

As you can see the "Brand" is removed but there is empty space there which I can not get rid of... .

How should I remove that empty space left from "Brand" and let the menu start from the left?

Thanks

2
  • How did you remove the brand? Did you remove navbar-header too.. Removing the brand seems to look fine: bootply.com/118722 Commented Mar 4, 2014 at 14:26
  • Can you share your code please ? Commented Mar 4, 2014 at 14:28

4 Answers 4

12

Try adding the below to your CSS:

.navbar .container-fluid, .navbar-collapse {
    padding-left:0;
}
.navbar-collapse.in {
    padding-left:30px;
}

Demo Fiddle

4
  • See fiddle: jsfiddle.net/swfour/52VtD/3320 you'll need to add this CSS below any used for Bootstrap
    – SW4
    Commented Mar 4, 2014 at 14:31
  • 1
    .navbar-collapse.collapse{ margin-left:-16px !important; } This does the trick but using margins... can I use it?
    – behz4d
    Commented Mar 4, 2014 at 14:32
  • 1
    Sure- it will prevent the need for the second rule- though note you should usually try avoiding !important
    – SW4
    Commented Mar 4, 2014 at 14:33
  • I mean using margin-left -16px wouldn't hurt my responsiveness?
    – behz4d
    Commented Mar 4, 2014 at 14:35
0

I've have solved the same issue by adding the following in my less file:

@media (min-width: @grid-float-breakpoint) {
    .container > .navbar-header, 
    .container-fluid > .navbar-header, 
    .container > .navbar-collapse, 
    .container-fluid > .navbar-collapse {
        margin-right: -15px;
        margin-left: -30px;
    }
}

When not collapsed, this will set the resulting spacing on both sites of the navbar to 15px. When collapsed, the normal margins apply.

0

Remove padding-left for uncollapsed menu; add padding when menu is collapsed using media query. Worked for me.


     .navbar .container-fluid, .navbar-collapse {
        padding-left:0;
     }

     @media(max-width: 768px){
        .navbar-collapse{
            padding-left:30px;
            padding-right:30px;
        }
     }

0

Removing the <a class="navbar-brand" href="#">Brand</a> HTML, and adding this CSS worked for me:

@media (min-width: 768px) {
  .navbar-nav {
    margin-left: -30px;
  } 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.