Bootstrap 3 - remove breakpoint between md and lg

前提是你 提交于 2019-12-03 14:55:48
Jamie Collingwood

If you're overriding the bootstrap breakpoint (and using containers properly), adding this below the bootstrap breakpoint media queries in the bootstrap CSS file should work for you.

If using LESS

@media (min-width: @screen-lg) { 
  .container {
      width: 970px;
   }
}

OR, you can simply override the bootstrap container in your own CSS (just make sure you load it after bootstrap.css)

@media (min-width: 970px) and (max-width: 2500px) {
   .container {
      width: 970px;
   }   
}

OR you can find the media query in the bootstrap.css file on around line 1240 and simply change it there

@media (min-width: 1200px) {
  .container {
     width: 1170px;  /* change 1170 to 970 */
  }
}

the less way is good but this one is more flexible and reliable:

@media (min-width: @screen-sm) { .container { width:@screen-md; } }

Because in bootstraps default values the width of @screen-md is 992px. Now you will just have a breakpoint for small devices (smartphones) and any other bigger devices. they will all get the same layout

You can set a max width on the containers:

.container-fluid,
.container {
  // Disable large-desktop breakpoint.
  max-width: $container-md;
}

No need for media queries or anything.

The $container-md value is typically 970px, unless you changed the $grid-gutter-width. For LESS, replace the $ of variables with an @. For regular CSS, replace the variable with the hard coded pixel size.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!