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
  • What are you trying to accomplish? Are you trying to change the `lg` breakpoint? – Zim Oct 09 '20 at 11:53
  • I need to specify style for elements on specific width and don`t want to create a new breakpoint for it – Evgenij Oct 09 '20 at 11:56

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

Zim
  • 329,487
  • 83
  • 671
  • 600