Halnex Halnex - 4 months ago 24
CSS Question

Change Bootstrap's mobile navbar breakpoint

I'm sorry if the title is confusing, the actual problem is very simple to understand.

I have a bootstrap responsive navbar which toggles between mobile and desktop view at 768px breakpoint.

However, I would like it to keep the mobile navbar til 992px breakpoint.

Because above 768px wide, this is how the menu looks

enter image description here

So I added a media query to the css to fix that

@media (min-width: 768px) and (max-width: 992px) {
.navbar-header {
float: none;

.navbar-toggle {
display: block;
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
.navbar-collapse.collapse {
display: none!important;
.navbar-nav {
float: none!important;
margin-top: 7.5px;
.navbar-nav>li {
float: none;
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
display:block !important;

Now the mobile menu toggles at 992px but the sub-menus are not displaying in their correct position above 768px and below 992px

enter image description here

How can I fix that?

And am I doing the media queries correctly?

jsFiddle: https://jsfiddle.net/8zne82d2/7/


You should also target .navbar-nav .open .dropdown-menu

Try to add something like this:

@media (max-width: 992px) {
  .navbar-nav .open .dropdown-menu {
    position: static;
    float: none;
    width: auto;
    margin-top: 0;
    background-color: transparent;
    border: 0;
    -webkit-box-shadow: none;
    box-shadow: none;

Example here https://jsfiddle.net/8zne82d2/9/