You could just use the custom bootstrap order classes and grid classes to achieve this. No need for media queries. Just specify order-lg-1
for large screens on DIV 1 and order-md-2
so it will be ordered 2nd on medium screens. Likewise, on DIV 2 use the class order-lg-2
so it will be ordered 2nd on large screens but order-md-1
so it will be ordered 1st on medium screens.
HTML could look something like:
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-12 order-lg-1 order-md-2 customDiv">DIV 1</div>
<div class="col-lg-9 col-md-12 order-lg-2 order-md-1 customDiv">DIV 2</div>
</div>
</div>
CSS could be something as simple as:
.customDiv {
border: 5px solid black;
height: 400px;
}
Link to codepen that shows this: https://codepen.io/andyreesecups-the-decoder/pen/mdbgEVY
Link about bootstrap grid classes: https://getbootstrap.com/docs/4.0/layout/grid/