Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set container max width to XXL breakpoint Bootstrap 5

I am trying out Bootstrap 5, on my site I do not want the container to grow beyond 1200px which is the XL breakpoint. Is there a way to either remove the XXL breakpoint or simply tell it not to grow beyond the XL breakpoint.

Preferably within my own custom CSS sheet rather than using SaSS/Less.

like image 721
Holo Avatar asked Jan 25 '23 13:01

Holo


2 Answers

Here's the sass answer for completeness sake: To remove the breakpoint from compiling in sass (including all utilities like col-xxl-*) override the default variables $grid-breakpoints and $container-max-widths and remove xxl from the array like so:

$grid-breakpoints: (
  xs: 0,
  sm: 576px,
  md: 768px,
  lg: 992px,
  xl: 1200px
);

$container-max-widths: (
  sm: 540px,
  md: 720px,
  lg: 960px,
  xl: 1140px
);

Make sure to include this before including bootstrap.

like image 34
kapoko Avatar answered Jan 31 '23 09:01

kapoko


Just set max-width on the .container...

.container {
    max-width: 1200px;
}

https://codeply.com/p/R0Y9RwNzqP

like image 131
Zim Avatar answered Jan 31 '23 07:01

Zim