Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to avoid bootstrap 3 nav bar collapsing into two rows

When I resize the window to a medium size the two links on the right collapse and cause the navbar to take two rows even though there is enough space between the right links and the left links.

http://www.bootply.com/fthRQCpN7d

like image 931
Ayrad Avatar asked Jun 28 '14 13:06

Ayrad


People also ask

How do I stop bootstrap navbar from collapsing?

For navbars that never collapse, add the . navbar-expand class on the navbar. For navbars that always collapse, don't add any .

How do I stop navbar from overlapping?

Add a padding of the size of your navbar's height to the body. Show activity on this post. Since 2017 add position: sticky; top:0; to navbar and it will fix this problem.

How do I keep my navbar fixed on top?

To create a fixed top menu, use position:fixed and top:0 .


1 Answers

You could write a @media-query to reduce the left/right padding when it hits the offending breakpoint:

@media(max-width:992px){
.nav>li>a {
padding-left: 10px;
padding-right:10px
    }
}

May not work for every instance, but seems to for your example: http://www.bootply.com/fthRQCpN7d

like image 132
Shawn Taylor Avatar answered Sep 28 '22 20:09

Shawn Taylor