Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 - remove breakpoint between md and lg

I'm using Bootstrap 3 and trying to remove/exclude the breakpoint between medium and large devices. I have a existing website which is optimised to 970px which looks great. What I am trying to do is remove the md > lg breakpoint so that even on large widescreen desktops the maximum body width is 970px and still centred.

Anyone know if there is a quickfix solution to this?

Any advice would be much appreciated

Decbrad

like image 386
decbrad Avatar asked Jan 22 '14 17:01

decbrad


People also ask

Does media query work with Bootstrap?

Since Bootstrap is developed to be mobile first, we use a handful of media queries to create sensible breakpoints for our layouts and interfaces. These breakpoints are mostly based on minimum viewport widths and allow us to scale up elements as the viewport changes.

How do I make Bootstrap container full width?

Choose from a responsive, fixed-width container (meaning its max-width changes at each breakpoint) or fluid-width (meaning it's 100% wide all the time). container-fluid class can be used to get full width container. container-fluid class provides a full-width container which spans the entire width of the viewport.

What is the function of breakpoint in Bootstrap?

Breakpoints are customizable widths that determine how your responsive layout behaves across device or viewport sizes in Bootstrap.


2 Answers

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 */
  }
}
like image 189
Jamie Collingwood Avatar answered Sep 30 '22 15:09

Jamie Collingwood


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

like image 28
nicmare Avatar answered Sep 30 '22 13:09

nicmare