2

Can I build media query using @include media-breakpoint-up(900px) in Bootstrap 4?

For example if I use:

@include media-breakpoint-up(900px){
   body: border 2px solid;
}

the output in .css will be without media query -> like this

Or it can be done only with creating of new breakpoint:

$grid-breakpoints: (
    // default breakpoints

    custom-lg: 90px,
);

and using like

@include media-breakpoint-up(custom-lg){
   body: border 2px solid;
}
Evgenij
  • 61
  • 4

1 Answers1

1

If look at the media-breakpoint-up mixin, you'll see it expects the $name parameter, which is the name of a breakpoint, not a pixel value..

@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
    ...
}

But you could pass in an alternative $breakpoints map (the 2nd param) with the new value for lg...

@include media-breakpoint-up(lg,(lg:900px)){
   body { 
       border: solid red 2px;
   }
}

Codeply

Related: Bootstrap 4 Change Breakpoints

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624